SA-MP Forums Archive
[Help] Cant make a 4 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Cant make a 4 team balancer... (/showthread.php?tid=147253)



[Help] Cant make a 4 team balancer... - Saurik - 11.05.2010

I tried my best, but i can only make team balancers for 2 teams and not four!

Help!

The teams are USA, China, Russia, Japan


Re: [Help] Cant make a 4 team balancer... - coole210 - 11.05.2010

Be more specific..

Balancer for what? Number of players on each team or what?



Re: [Help] Cant make a 4 team balancer... - ViruZZzZ_ChiLLL - 11.05.2010

or show us the code, so we can help you with this


Re: [Help] Cant make a 4 team balancer... - [HiC]TheKiller - 11.05.2010

What are the 4 teams? Also, are you using gTeam or another variable?


Re: [Help] Cant make a 4 team balancer... - Saurik - 11.05.2010

hey, thanks for replies. yes im using gteam.

And my server has 50 slots, soon will have more.

i want it to balance out.

i cant really tell you how many per team, because what if there are 6 players on, 5 on one team and 1 on other


Re: [Help] Cant make a 4 team balancer... - Mikep. - 11.05.2010

Simple, put them on the team with the lowest amount of players. If they all have the same, random team.


Re: [Help] Cant make a 4 team balancer... - Saurik - 11.05.2010

i know.. but i cant script it, thats what i posted [obv]


Re: [Help] Cant make a 4 team balancer... - Zh3r0 - 11.05.2010

I got this from a GM, not actually what you want
but could be usefull

pawn Код:
for(new p = 0; p < GetMaxPlayers(); p++)
  {
    if (GetPlayerTeam(p) == TEAM_ArmyRUS) Count1++;
    else if (GetPlayerTeam(p) == TEAM_ArmyUSA) Count2++;
  }
  if ((Count1 > Count2) && GetPlayerTeam(playerid) == TEAM_ArmyUSA)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }
  else if ((Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_ArmyRUS)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }