SA-MP Forums Archive
Getting the server to detect how many players are on and denying access if there are less than 10... - 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: Getting the server to detect how many players are on and denying access if there are less than 10... (/showthread.php?tid=347175)



Getting the server to detect how many players are on and denying access if there are less than 10... - cloudysky - 31.05.2012

Hey I've just come back to coding after ages. I am wondering how to make it so when someone does something then a message like this pops up

"There are less than 10 players so this will not be given to you"

I know to do this through sendclientmessage but how do i get it to detect if there are less than 10 players on?


Re: Getting the server to detect how many players are on and denying access if there are less than 10... - kaisersouse - 31.05.2012

Код:
new players;
for(new i; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i)) players++;
}
if(players < 10) return SendClientMessage(playerid,COLOR,"There are less than 10 players so this will not be given to you");