team balance issue
#10

Try this

On top
pawn Код:
new players, cop, terrorist;
pawn Код:
public OnPlayerConnect(playerid)
{
    players++;
    return 1;
}  

public OnPlayerDisconnect(playerid)
{
    players--;
    if(GetPlayerTeam(playerid) == TEAM_COPS)
    {
        cop--;
    }
    else if(GetPlayerTeam(playerid) == TEAM_TERRORISTS)
    {
        terrorist--;
    }
    return 1;
}
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    new _limit = (players/2), bool:limit;
    if(terrorist >= _limit || cop >= _limit)
    {
        limit = true;
    }
    else
    {
        limit = false;
    }
    if(classid == TEAM_COPS && limit == true) return SendClientMessage(playerid, 0xFF0000, "That team is full!");
    else
    {
        cop++;
    }
    if(classid == TEAM_TERRORISTS && limit == true) return SendClientMessage(playerid, 0xFF0000, "That team is full!");
    else
    {
        terrorist++;
    }
    return 1;
}
Always try to use SetPlayerTeam with this
Reply


Messages In This Thread
team balance issue - by PawnoQ - 18.12.2011, 13:52
Re: team balance issue - by §с†¶e®РµРe - 18.12.2011, 15:07
Re: team balance issue - by PawnoQ - 18.12.2011, 15:15
Re: team balance issue - by Gamer_Z - 18.12.2011, 15:18
Re: team balance issue - by §с†¶e®РµРe - 18.12.2011, 15:20
Re: team balance issue - by PawnoQ - 18.12.2011, 15:36
Re: team balance issue - by Thresholdold - 18.12.2011, 15:43
Re: team balance issue - by PawnoQ - 18.12.2011, 15:47
Re: team balance issue - by Thresholdold - 18.12.2011, 15:52
Re: team balance issue - by suhrab_mujeeb - 18.12.2011, 17:23

Forum Jump:


Users browsing this thread: 1 Guest(s)