SA-MP Forums Archive
count players - 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)
+--- Thread: count players (/showthread.php?tid=676080)



count players - Ertouq - 29.05.2020

Hello, I have come up with an interesting minigame but I don't know how to match the number of players, if team 1 has 1 player, you enter Team 2 and when Team 2 has the same amount, the next player enters Team 1 and so on...

Thanks!


Re: count players - xRadical3 - 29.05.2020

See this example:
pawn Code:
new TDM_Count = 0; //on top of script

TDM_Count++; //Add 1 to the var
if(TDM_Count == 3) TDM_Count = 1; //If the var is 3, we set it to 1
SetPlayerTeam(playerid, TDM_Count); //finally, set the player team
// TDM_Count can only be 1 or 2



Re: count players - Ertouq - 29.05.2020

Quote:
Originally Posted by xRadical3
View Post
See this example:
pawn Code:
new TDM_Count = 0; //on top of script

TDM_Count++; //Add 1 to the var
if(TDM_Count == 3) TDM_Count = 1; //If the var is 3, we set it to 1
SetPlayerTeam(playerid, TDM_Count); //finally, set the player team
// TDM_Count can only be 1 or 2
Thanks!