PDA

View Full Version : Script error (S&D)



Loveboy
16th February 2013, 13:53
Hi Guys, i have a Seach and Destroy server.
If a Team get a point a error will come (it's not a error from my mod):
script runtime error
(see console for details)
file: maps/mp/gametypes/sd.gsc line 1339
script:

updateTeamStatus()
{
wait 0; // Required for Callback_PlayerDisconnect to complete before updateTeamStatus can execute

resettimeout();

oldvalue["allies"] = level.exist["allies"];
oldvalue["axis"] = level.exist["axis"];
level.exist["allies"] = 0;
level.exist["axis"] = 0;

players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
player = players[i];

if(isdefined(player.pers["team"]) && player.pers["team"] != "spectator" && player.sessionstate == "playing")
level.exist[player.pers["team"]]++;
}

if(level.exist["allies"])
level.didexist["allies"] = true;
if(level.exist["axis"])
level.didexist["axis"] = true;

if(level.roundended)
return;

// if both allies and axis were alive and now they are both dead in the same instance
if(oldvalue["allies"] && !level.exist["allies"] && oldvalue["axis"] && !level.exist["axis"])
{
if(level.bombplanted)
{
// if allies planted the bomb, allies win
if(level.planting_team == "allies")
{
iprintln(&"MP_ALLIEDMISSIONACCOMPLISHED");
level thread endRound("allies");
return;
}
else // axis planted the bomb, axis win
{
assert(game["attackers"] == "axis");
iprintln(&"MP_AXISMISSIONACCOMPLISHED");
level thread endRound("axis");
return;
}
}

// if there is no bomb planted the round is a draw
iprintln(&"MP_ROUNDDRAW");
level thread endRound("draw");
return;
}

// if allies were alive and now they are not
if(oldvalue["allies"] && !level.exist["allies"])
{
// if allies planted the bomb, continue the round
if(level.bombplanted && level.planting_team == "allies")
return;

iprintln(&"MP_ALLIESHAVEBEENELIMINATED");
level thread playSoundOnPlayers("mp_announcer_allieselim");
level thread endRound("axis");
return;
}

// 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;

iprintln(&"MP_AXISHAVEBEENELIMINATED");
level thread playSoundOnPlayers("mp_announcer_axiselim");
level thread endRound("allies");
return;
}
}

EvoloZz
16th February 2013, 14:02
More details? Which line is it? Are you even using /set developer 1 ?

Loveboy
16th February 2013, 14:12
line 1339: players = getentarray("player", "classname"); , and no, idk what is /set devolper 1

Tally
16th February 2013, 14:19
Hi Guys, i have a Seach and Destroy server.
If a Team get a point a error will come (it's not a error from my mod):
script runtime error
(see console for details)
file: maps/mp/gametypes/sd.gsc line 1339
script:

updateTeamStatus()
{
wait 0; // Required for Callback_PlayerDisconnect to complete before updateTeamStatus can execute

resettimeout();

oldvalue["allies"] = level.exist["allies"];
oldvalue["axis"] = level.exist["axis"];
level.exist["allies"] = 0;
level.exist["axis"] = 0;

players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
player = players[i];

if(isdefined(player.pers["team"]) && player.pers["team"] != "spectator" && player.sessionstate == "playing")
level.exist[player.pers["team"]]++;
}

if(level.exist["allies"])
level.didexist["allies"] = true;
if(level.exist["axis"])
level.didexist["axis"] = true;

if(level.roundended)
return;

// if both allies and axis were alive and now they are both dead in the same instance
if(oldvalue["allies"] && !level.exist["allies"] && oldvalue["axis"] && !level.exist["axis"])
{
if(level.bombplanted)
{
// if allies planted the bomb, allies win
if(level.planting_team == "allies")
{
iprintln(&"MP_ALLIEDMISSIONACCOMPLISHED");
level thread endRound("allies");
return;
}
else // axis planted the bomb, axis win
{
assert(game["attackers"] == "axis");
iprintln(&"MP_AXISMISSIONACCOMPLISHED");
level thread endRound("axis");
return;
}
}

// if there is no bomb planted the round is a draw
iprintln(&"MP_ROUNDDRAW");
level thread endRound("draw");
return;
}

// if allies were alive and now they are not
if(oldvalue["allies"] && !level.exist["allies"])
{
// if allies planted the bomb, continue the round
if(level.bombplanted && level.planting_team == "allies")
return;

iprintln(&"MP_ALLIESHAVEBEENELIMINATED");
level thread playSoundOnPlayers("mp_announcer_allieselim");
level thread endRound("axis");
return;
}

// 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;

iprintln(&"MP_AXISHAVEBEENELIMINATED");
level thread playSoundOnPlayers("mp_announcer_axiselim");
level thread endRound("allies");
return;
}
}

Stock SD does not return script runtime errors. So, it must be your mod affecting how SD is running. There must be something in your mod which is causing the wait time in the updateTeamStatus() to bulk. So, you can either try to increase the wait time from 0 to 1 second; or you can try to locate what it is in your mod that is causing the hiccup in the server and causing the stock wait time of 0 to produce the error.