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



Players - 3RoR - 02.08.2012

How to create a function on cmd /robbank(if 15 Police Officers are not online to Show EROR:You can't rob today.)


Re: Players - Ranama - 02.08.2012

You'll have to loop trough all players and see if they are polices and if there are, you make a variable ++, like this:

pawn Код:
//add this to your command
new polices;
for(new i = 0; i<MAX_PLAYERS; i++){
if(playerinfo[i[police] == 1){//make your variables here
polices ++;
}
}
if(polices < 15)return SendClientMessage(playerid, COLOR_ERROR, "There are not enought polices online at this moment, you can't rob a bank!");
Hope I helped