How to make Team balancer?
#3

Example:
pawn Код:
new gTeam1,
gTeam2,
pTeam[MAX_PLAYERS];

public OnPlayerSpawn(playerid)
{
    if(gTeam1 <= gTeam2)
    {
        SendClientMessage(playerid, -1 "You have joined team 1!");
        pTeam[playerid] = 1;
        gTeam1 ++;
    }
    else
    {
        SendClientMessage(playerid, -1 "You have joined team 2!");
        pTeam[playerid] = 2;
        gTeam2 ++;
    }
    return 1;
}

CMD:balanceteams(playerid, params[])
{
    SendClientMessageToAll(-1, "An administrator has balanced the teams!");

    gTeam1 = 0, gTeam2 = 0;
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(gTeam1 <= gTeam2)
        {
            SendClientMessage(playerid, -1 "You have joined team 1!");
            pTeam[playerid] = 1;
            gTeam1 ++;
        }
        else
        {
            SendClientMessage(playerid, -1 "You have joined team 2!");
            pTeam[playerid] = 2;
            gTeam2 ++;
        }
    }
    return 1;
}
Reply


Messages In This Thread
How to make Team balancer? - by Fantje - 21.03.2015, 17:06
Re: How to make Team balancer? - by ReD_HunTeR - 21.03.2015, 17:25
Re: How to make Team balancer? - by SickAttack - 21.03.2015, 17:31
Re: How to make Team balancer? - by Fantje - 21.03.2015, 17:41
Re: How to make Team balancer? - by ReD_HunTeR - 21.03.2015, 18:34
Re: How to make Team balancer? - by SickAttack - 21.03.2015, 18:39
Re: How to make Team balancer? - by Fantje - 21.03.2015, 18:59
Re: How to make Team balancer? - by SickAttack - 21.03.2015, 19:01
Re: How to make Team balancer? - by Fantje - 21.03.2015, 19:05
Re: How to make Team balancer? - by SickAttack - 21.03.2015, 19:15

Forum Jump:


Users browsing this thread: 1 Guest(s)