team balance
#3

pawn Код:
// At the top of the script.

new Count_Police;
new Count_Terrorists;

// --------------------------------------

public OnPlayerRequestSpawn(playerid)
{
    if((Count_Police > Count_Terrorists) && GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        GameTextForPlayer(playerid, "~r~Police team is full!", 600, 5);
        PlayerPlaySound(playerid,1055,0, 0, 0);
        return 0;
    }
    if((Count_Police < Count_Terrorists) && GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        GameTextForPlayer(playerid, "~r~Terrorists team is full!", 600, 5);
        PlayerPlaySound(playerid,1055,0, 0, 0);
        return 0;
    }
    if(GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        Count_Police++;
    }
    else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        Count_Terrorists++;
    }
    return 1;
}
I did some important changes, now it should work fine.

EDIT:

Also make sure when a player disconnects to reduce the amount of their team.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(GetPlayerTeam(playerid) == TEAM_POLICE)
    {
        Count_Police--;
    }
    else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        Count_Terrorists--;
    }
    return 1;
}
Reply


Messages In This Thread
team balance - by BlackWolf120 - 23.02.2011, 17:09
Re: team balance - by Hashski - 23.02.2011, 18:09
Re: team balance - by Serbish - 23.02.2011, 18:27
Re: team balance - by BlackWolf120 - 23.02.2011, 20:30
Re: team balance - by BlackWolf120 - 08.03.2011, 01:30
Re: team balance - by Roperr - 07.10.2011, 23:30

Forum Jump:


Users browsing this thread: 1 Guest(s)