[HELP]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]Team balancer (
/showthread.php?tid=178640)
[HELP]Team balancer -
Matej_ - 23.09.2010
How can I make a team balancer ?
Note: I have 2 teams in my script.
Re: [HELP]Team balancer -
LarzI - 23.09.2010
Use an array or two variables to store the players in each induvidual(sp?) team, then prevent the player to join the certain team, if it's player count is too much.
Example:
pawn Код:
//when player joins team
if( pCount[ 0 ] - pCount[ 1 ] > 2 || pCount[ 1 ] - pCount[ 0 ] > 2 )
{
SendClientMessage( playerid, 0xFF0000FF, "To balance the teams, you are forced to join the other team." );
//join the other team
}
//join the team he wanted to join (else)
EDIT: And if you want an automatic updater, make a timer to check the team counts, then balance them by moving a player over (or two)