19.04.2012, 16:39
The system does the opposite from what I wanted, if all SWAT team members die it says SWAT won and if all Criminals team members die it says Criminals won.
What's wrong in this function?
What's wrong in this function?
PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
SetPlayerScore(killerid, GetPlayerScore(killerid)+1);
if(gTeam[playerid] == TEAM_SWAT) gSWAT--;
else if(gTeam[playerid] == TEAM_CRIMINALS) gCriminals--;
if(gCriminals == 0)
{
SendClientMessageToAll(COLOR_BLUE, "SWAT has won this round!");
gRounds++;
SetEveryoneToSpawn(playerid);
}
else if(gSWAT == 0)
{
SendClientMessageToAll(COLOR_RED, "Criminals has won this round!");
gRounds++;
SetEveryoneToSpawn(playerid);
}
if(gCriminals > 0 && gSWAT > 0)
{
gSpectating[playerid] = 1;
SetToSpectate(playerid);
}
CancelSpectate(playerid);
if(gRounds >= 6) GameModeExit();
return 1;
}