Team Balancer Question
#5

So, I've got this:
pawn Code:
public OnPlayerRequestSpawn(playerid)
{
    new team1 = GetPlayersInTeamFromMaxPlayers(TEAM_RED);
    new team2 = GetPlayersInTeamFromMaxPlayers(TEAM_GREEN);
    if(team1 > team2 && Team[playerid] == TEAM_RED && !IsPlayerVIP(playerid))
    {
        TextDrawShowForPlayer(playerid,balancer);
        SetTimer("HideBalancer",4000,0);
        return 0;
    }
    else if(team2 > team1 && Team[playerid] == TEAM_GREEN && !IsPlayerVIP(playerid))
    {
        TextDrawShowForPlayer(playerid,balancer);
        SetTimer("HideBalancer",4000,0);
        return 0;
    }
    return 1;
}

forward HideBalancer(playerid);
public HideBalancer(playerid)
{
    TextDrawHideForPlayer(playerid,balancer);
}

stock GetPlayersInTeamFromMaxPlayers(teamid)
{
    new playercount = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(HasPlayerSpawned[i] == false) continue;
        if(GetPlayerState(i) == PLAYER_STATE_NONE) continue;
        if(Team[i] != teamid) continue;
        playercount++;
    }
    return playercount;
}
Would this work? Or do I need something else?
Reply


Messages In This Thread
Team Balancer Question - by Tigerbeast11 - 10.09.2011, 14:03
Re: Team Balancer Question - by Darnell - 10.09.2011, 14:10
Re: Team Balancer Question - by Basicz - 10.09.2011, 14:11
Re: Team Balancer Question - by Tigerbeast11 - 10.09.2011, 14:28
Re: Team Balancer Question - by Tigerbeast11 - 10.09.2011, 14:51

Forum Jump:


Users browsing this thread: 2 Guest(s)