OnPlayerDeath
#1

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?
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;
} 
Reply


Messages In This Thread
OnPlayerDeath - by Tomer!.$ - 19.04.2012, 16:39
Re: OnPlayerDeath - by sleepysnowflake - 19.04.2012, 16:46
Re : OnPlayerDeath - by Tomer!.$ - 19.04.2012, 17:26
Re: OnPlayerDeath - by ViniBorn - 19.04.2012, 18:04
Re : OnPlayerDeath - by Tomer!.$ - 20.04.2012, 08:30
Re : OnPlayerDeath - by Tomer!.$ - 20.04.2012, 11:07
Re: OnPlayerDeath - by jop9888 - 20.04.2012, 11:16
Re: OnPlayerDeath - by Unknown1234 - 20.04.2012, 11:20
Re : OnPlayerDeath - by Tomer!.$ - 20.04.2012, 11:55
Re : OnPlayerDeath - by Tomer!.$ - 20.04.2012, 12:05

Forum Jump:


Users browsing this thread: 1 Guest(s)