How to balance teams - 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: How to balance teams (
/showthread.php?tid=177540)
How to balance teams -
Matej_ - 18.09.2010
How can I balance teams ?
Note: In my script there are 2 teams
TEAM_CT
TEAM_T
Re: How to balance teams -
Seven. - 18.09.2010
Make a team balancer :P
Re: How to balance teams -
Hiddos - 18.09.2010
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.
Re: How to balance teams -
Matej_ - 18.09.2010
Quote:
Originally Posted by Seven.
Make a team balancer :P
|
Thanks that was so helpfull !
Re: How to balance teams -
Matej_ - 18.09.2010
Quote:
Originally Posted by Hiddos
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 ?
Re: How to balance teams -
Hiddos - 18.09.2010
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
Re: How to balance teams -
FireCat - 18.09.2010
only u hiddos, only u xD