Auto team balance script. - 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: Auto team balance script. (
/showthread.php?tid=116323)
Auto team balance script. -
Striker_Moe - 28.12.2009
Hi there!
Iґm about to create a team-balance-script. So new players cannot take a team which is more full then the others. Iґm done so far, but the last part is tricky.
When using OnPlayerRequestSpawn - how can I find out the team which the player wants to join?
Re: Auto team balance script. -
dice7 - 28.12.2009
by the skinid
Re: Auto team balance script. -
Donny_k - 28.12.2009
Maybe I've not understood your question but to me the balancer does the work for you, you only get to select a team if they're not already balanced. You do the math on team counts then if they are not balanced use SetSpawnInfo & SpawnPlayer to skip class selection and set the player on the lower team, if they are balanced then you allow the class selection to happen.
Take a look at my post
here, where I say "force" I mean SetSpawnInfo & SpawnPlayer, the code would go in OnPlayerRequestClass (class would be like team in the examples case). The random code is just there for an example, you could/would again allow them to pick the class instead of doing it for them unless you wanted it to be random obviously.