SA-MP Forums Archive
[HELP NEEEDED] 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 NEEEDED] Team Balancer (/showthread.php?tid=140400)



[HELP NEEEDED] Team Balancer - Awerop - 08.04.2010

Hey, i have a team balancer.. i have 5 teams and i want the teams to be balanced


can u take a look at my script and tell me if it will work/




http://pastebin.com/s0BM97vW


Код:
new Count1, Count2, Count3, Count4, Count5;
  for(new p = 0; p < GetMaxPlayers(); p++)
  {
    if (GetPlayerTeam(p) == TEAM_USA) Count1++;
    else if (GetPlayerTeam(p) == TEAM_GERMANY) Count2++;
    else if (GetPlayerTeam(p) == TEAM_TALIBAN) Count3++;
		else if (GetPlayerTeam(p) == TEAM_RUSSIA) Count4++;
    else if (GetPlayerTeam(p) == TEAM_JAPAN) Count5++;


	}
  if ((Count1 > Count2 > Count3 > Count4 > Count5) && GetPlayerTeam(playerid) == TEAM_USA)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }
  else if ((Count2 > Count1 > Count3 > Count4 > Count5) && GetPlayerTeam(playerid) == TEAM_GERMANY)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }
 else if ((Count3 > Count2 > Count4 > Count1 > Count5) && GetPlayerTeam(playerid) == TEAM_TALIBAN)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }
 else if ((Count4 > Count5 > Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_RUSSIA)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }
 else if ((Count5 > Count1 > Count4 > Count3 > Count2) && GetPlayerTeam(playerid) == TEAM_JAPAN)
  {
    SendClientMessage(playerid,COLOR_RED, "[SERVER] Please choose another team so match will be balanced.");
    return 0;
  }

 return 1;
}