SA-MP Forums Archive
Limited 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: Limited players (/showthread.php?tid=412966)



Limited players - Vrag - 03.02.2013

I got DM server...Allway it has got 70 players in grove street gang.So i need script for limited players in one gang like max players can be in one gang.


Re: Limited players - Jstylezzz - 03.02.2013

I can't be extremely detailed since you haven't provided any code, but I would start by saving the number of members a gang has, and then checking how much members there are when someone tries to join the gang.
Then let the script send a message if the saved number is the maximal number, defined by you, so the player knows he has to join some other gang.


Re: Limited players - Scenario - 03.02.2013

Basically you need to make a new variable per-gang. So for example:

pawn Код:
new gangMembers_Grove;
Each time someone joins the grove gang, do this:

pawn Код:
gangMembers_Grove++;
That will increase the variable by one each time you do that code.

You will also want to run a check before performing the code above to see how many people are in the gang already. For example:

pawn Код:
if(gangMembers_Grove == MAX_MEMBERS_PER_GROUP)
If that variable is true, you'll want to make the player select a new group. Otherwise, let them join the group and add to the variable (the thing posted above).


Re: Limited players - SKAzini - 03.02.2013

pawn Код:
new GroveStreetPlayers;

if(GroveStreetPlayers <= 20) GroveStreetPlayers++; //player tries to join, if grove players are under 20, make player in grove