Team choise - 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: Team choise (
/showthread.php?tid=663322)
Team choise -
Matyaas - 28.01.2019
Forum people, I have a question, how can I make a maximum for teams? for example when the team red and blue are uneven, 2 in red and in blue 1. How can i make a player by choosing red (that has 2) you deny the function and tell him that the team is full that he chooses another ?
Re: Team choise -
faxxe - 28.01.2019
You can check if a team is uneven using this operator %
If(GetPlayerCount(teamid) % 2 != 0 )
This way you can solve this problem.
You need some function to get the amount of players inside of a team. Like that
Код:
stock GetTeamPlayerCount(teamid) { new playercount = 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(!PlayerInfo[i][pSpawned]) continue; if(!gPlayerHasTeamSelected[i]) continue; if(GetPlayerState(i) == PLAYER_STATE_NONE) continue; if(gPlayerTeamSelection[i] != teamid) continue; playercount++; } return playercount; }
Re: Team choise -
Matyaas - 28.01.2019
Quote:
Originally Posted by ******
y_groups has a balance function for exactly this.
|
hello and_less I appreciate your help, but i do not know the use of your include can you help?