how to make auto team balance?
#2

pawn Код:
new TeamPlayers[ <Amount of teams here> ];

public OnPlayerRequestSpawn(playerid)
{
    for(new teams; teams < [Team Amount]; teams++)
    {
        if(teams == gTeam[playerid]) continue;
        if(TeamPlayers[gTeam[playerid]] > TeamPlayers[teams] + 3)
        {
            SendClientMessage(playerid, COLOR_RED, "You can't join this team as it would unbalance the game!");
            return 0;
        }
    }  
}
//By Hiddos
So... Example usage:
pawn Код:
public OnPlayerRequestSpawn( playerid )
{
    for( new teams; teams < 23; teams++ )
    {
        if( teams == gTeam[ playerid ] ) continue;
        if( TeamPlayers[ gTeam[ playerid ] ] > TeamPlayers[ teams ] + 3)
        {
            SendClientMessage( playerid, COLOR_RED, "You can't join this team as it would unbalance the game!" );
            return 0;
        }
    }
    return 1;
}
Reply


Messages In This Thread
how to make auto team balance? - by Medal Of Honor team - 12.02.2011, 15:44
Re: how to make auto team balance? - by Mean - 12.02.2011, 16:02

Forum Jump:


Users browsing this thread: 1 Guest(s)