SA-MP Forums Archive
Team balance (+rep) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Team balance (+rep) (/showthread.php?tid=328688)



Team balance - mrskull42 - 25.03.2012

I was wondering how to make a team balance with four teams.

Two teams are on same Team (FBI, Police) and other two teams are on another same Team, (Psychos, Criminals)

If someone could please help me out, +rep.

Thanks.


Re: Team balance (+rep) - Cinnt - 25.03.2012

https://sampforum.blast.hk/showthread.php?tid=224853 - read this.
Next time use search engine.


Re: Team balance (+rep) - mrskull42 - 25.03.2012

There's more than those four teams in the game, the script you post wouldn't specificly choose those teams.


Re: Team balance (+rep) - Cinnt - 25.03.2012

http://forum.sa-mp.com/showpost.php?...09&postcount=4

http://forum.sa-mp.com/showpost.php?...68&postcount=2

Thats all I can find for you, its time for you to do it as well.


Re: Team balance (+rep) - AustinJ - 25.03.2012

Is this what you are looking for?

pawn Код:
new Player_Team[MAX_PLAYERS];

stock ChooseTeam(playerid)
{
    new T1, T2, T3, T4;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(Player_Team[i]> 0)
            {
                if(Player_Team[i] == 1) T1++;
                if(Player_Team[i] == 2) T2++;
                if(Player_Team[i] == 3) T3++;
                if(Player_Team[i] == 4) T4++;
            }
        }
    }
    if(T1+T2 > T3+T4)
    {
        if(T1 > T2)
        {
            Player_Team[playerid] = 2;
        }
        else
        {
            Player_Team[playerid] = 1;
        }
    }
    else
    {
        if(T3 > T4)
        {
            Player_Team[playerid] = 4;
        }
        else
        {
            Player_Team[playerid] = 3;
        }
    }
}



Re: Team balance (+rep) - mrskull42 - 25.03.2012

Nevermind I found one +rep to both of you