How to balance teams
#1

How can I balance teams ?

Note: In my script there are 2 teams

TEAM_CT
TEAM_T

Reply
#2

Make a team balancer :P
Reply
#3

Keep track of the amount of players in each team, then call those variables at OnPlayerRequestSpawn to see if a specific team has too much or too less players and, if so, return '0' at OnPlayerRequestSpawn.
Reply
#4

Quote:
Originally Posted by Seven.
View Post
Make a team balancer :P
Thanks that was so helpfull !
Reply
#5

Quote:
Originally Posted by Hiddos
View Post
Keep track of the amount of players in each team, then call those variables at OnPlayerRequestSpawn to see if a specific team has too much or too less players and, if so, return '0' at OnPlayerRequestSpawn.
Can you make a example please ?
Reply
#6

pawn Code:
new TeamCount[2];

public OnPlayerRequestSpawn(playerid)
{
  if((gTeam[playerid] == TEAM_CT) ? (TeamCount[0] > TeamCount[1]+3) : (TeamCount[0] < TeamCount[1]+3))
  {
    SendClientMessage(playerid, 0x00ff00ff, "Unable to spawn, the teams aren't balanced!");
    return 0;
  }
  TeamCount[(gTeam[playerid] == TEAM_CT) ? (0) : (1)]++;
}
You'll need to work on something to reset this variable again, for example when a player joins a different team or disconnect, set the specific team's count minus one.

Also, this is just a crappy example. I guess it's best to make your own system
Reply
#7

only u hiddos, only u xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)