team balancer
#10

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 ...
Reply


Messages In This Thread
team balancer - by thuron - 22.10.2009, 18:44
Re: team balancer - by Peter_Corneile - 22.10.2009, 19:28
Re: team balancer - by thuron - 22.10.2009, 19:42
Re: team balancer - by Tigerbeast11 - 22.10.2009, 19:43
Re: team balancer - by Peter_Corneile - 22.10.2009, 19:45
Re: team balancer - by miokie - 22.10.2009, 19:45
Re: team balancer - by thuron - 22.10.2009, 19:47
Re: team balancer - by Tigerbeast11 - 22.10.2009, 19:49
Re: team balancer - by thuron - 23.10.2009, 15:53
Re: team balancer - by Nero_3D - 23.10.2009, 16:32

Forum Jump:


Users browsing this thread: 1 Guest(s)