SA-MP Forums Archive
Team Balancer - 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 Balancer (/showthread.php?tid=484194)



Team Balancer - RowdyrideR - 29.12.2013

I really keep failing with that.
Been searching a lot, Since last year I guess, But still failing.

I could find this:

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
#define NUM_TEAMS (2)
pawn Код:
#if defined NUM_TEAMS
    #if NUM_TEAMS > 1
        new T_Counter[NUM_TEAMS];
    #endif
#endif
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    //other code you got
    #if defined NUM_TEAMS
        #if NUM_TEAMS > 1
            #if !defined gTeam
                #error Team Balancer: didnt found the example team variable, change it!
            #endif
            new bigger_teams;
            for(new i; i < NUM_TEAMS; i++) if(T_Counter[i] > T_Counter[gTeam[playerid]]) bigger_teams++;
            if(bigger_teams < (NUM_TEAMS / 2)) return false;
            T_Counter[gTeam[playerid]]++;
        #endif
    #endif
    //other code you got
}
Examples

1 Team, team balancer is deactivated :O (same when you comment NUM_TEAMS)
2 Teams, players can only join the weakest team
3 Teams, players can only join the weakest team
4 Teams, players can join the two weakest teams
5 Teams, players can join the two weakest teams
6 Teams, players can join the three weakest teams
... and so on ...
But still understood nothing.
Can someone help me?
Need a balancer for 4 teams.
Thanks.