Help ASAP [+rep]
#1

Ok guys i need a team balance script.I tryed hiddos's one but it gived errors.Ok i use SetPlayerTeam i have 2 teams.IF other team more then other team they cant join that team.

Need help asap because people keep choosing first skin
Reply
#2

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    new team1count, team2count;
    for(new i, m = GetMaxPlayers(); i < m; i++)
    {
        if (IsPlayerConnected(i))
        {
            if (gTeam[i] == TEAM_ONE) team1count++;
            else if (gTeam[i] == TEAM_TWO) team2count++;
        }
    }
    if (gTeam[playerid] == TEAM_ONE)
    {
        if (team1count > (team2count+1)){
        SendClientMessage(playerid, COLOR_YELLOW, "This team is full, please choose the other one.");
            return 0;
        }

    }
    else if (gTeam[playerid] == TEAM_TWO)
    {
        if ((team1count+1) < team2count){
        SendClientMessage(playerid, COLOR_YELLOW, "This team is full, please choose the other one.");
            return 0;
        }
    }
    return 1;
}
Good Luck with it!
Change the gTeams.
Reply
#3

You sure this scripts works?
Reply
#4

Thanks it works +rep
Reply
#5

Glad to hear!
Reply
#6

Why would you use a loop when you can increment team2count and team1count when other players spawn then do your other checks on onplayerrequestspawn?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)