Hi
I am trying to make a roundcam inspired by CoDaM of CoD 1.1
(by roundcam I mean the player who killed the last in opposing team, will produce a killcam that everyone will see)
I have no errors, but after killing the last enemy, a few seconds pass, then only about 0.2 sec of the roundcam is displayed, and then the new round starts...
Can you see the error in the following code parts?
in _killcam.gsc
PHP Code:
roundcam(goal, delay, msg, offsetTime)
{
printf("######### _killcam: roundcam \n");
self.sessionstate = "spectator";
if (isPlayer(goal))
{
self.spectatorclient = goal getEntityNumber();
}
else
{
self.spectatorclient = -1;
self spawn(goal.origin , goal.angles);
}
self.archivetime = delay + 7;
self.psoffsettime = offsetTime;
// ignore spectate permissions
self allowSpectateTeam("allies", true);
self allowSpectateTeam("axis", true);
self allowSpectateTeam("freelook", true);
self allowSpectateTeam("none", true);
// wait till the next server frame to allow code a chance to update archivetime if it needs trimming
wait 0.05;
...
self removeKillcamElements();
self.spectatorclient = -1;
self.archivetime = 0;
self.psoffsettime = 0;
self thread maps\mp\gametypes\_spectating::setSpectatePermissions();
level notify("roundcam_ended");
}
in sd.gsc
PHP Code:
endRound(roundwinner, cam, offset)
{
...
if (doRoundcam)
{
level roundCam(cam, roundwinner, offset);
}
else
{
level notify("restarting");
map_restart(true);
}
}
//////////////////////////////////////////////////////////
roundCam(cam, roundwinner, offset)
{
if (!isdefined(cam) || !isdefined(roundwinner) || !isdefined(offset))
{
wait(3);
return;
}
delay = 2;
wait(delay);
...
viewers = 0;
players = getentarray("player", "classname");
for (i = 0; i < players.size; i++)
{
player = players[i];
if (isdefined(player.killcam) || (player.archivetime > 0))
{
// Already running killcam, stop it
player notify("spawned");
wait(0.05);
player.spectatorclient = -1;
player.archivetime = 0;
}
player thread maps\mp\gametypes\_killcam::roundcam(cam, delay, text, offset);
viewers++;
}
if (viewers)
{
level waittill("roundcam_ended");
level notify("restarting");
map_restart(true);
}
else
{
wait(3 - delay);
}
}
//////////////////////////////////////////////////////////
updateTeamStatus()
{
...
// if axis were alive and now they are not
if(oldvalue["axis"] && !level.exist["axis"])
{
// if axis planted the bomb, continue the round
if(level.bombplanted && level.planting_team == "axis")
return;
_announce = &"MP_AXISHAVEBEENELIMINATED";
iprintln(&"MP_AXISHAVEBEENELIMINATED");
level thread playSoundOnPlayers("mp_announcer_axiselim");
level thread endRound("allies", level.playercam, level.offsetTimeCam);
return;
}
}
I know that the roundcam func of _killcam.gsc gets called because I see the following message in my server terminal:
Could you please take a look?