Auto balance
#2

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


Messages In This Thread
Auto balance - by suhrab_mujeeb - 11.09.2011, 12:04
Re: Auto balance - by Pinguinn - 11.09.2011, 12:08
Re: Auto balance - by suhrab_mujeeb - 11.09.2011, 13:13
Re: Auto balance - by DRIFT_HUNTER - 11.09.2011, 13:22
Re: Auto balance - by Pinguinn - 11.09.2011, 13:53
Re: Auto balance - by suhrab_mujeeb - 11.09.2011, 13:58

Forum Jump:


Users browsing this thread: 1 Guest(s)