SA-MP Forums Archive
count cops online - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: count cops online (/showthread.php?tid=159938)



count cops online - aNdReSk - 15.07.2010

PlayerInfo[playerid][profession] == COP


Im making a command that should give money depeending on how many cops are in server! :P
How can I count COPS in an efficient way?


Re: count cops online - [HiC]TheKiller - 15.07.2010

pawn Код:
new count;
for(new i; i<MAX_PLAYERS; i++)
{
    if(!IsPlayerConnected(i)) continue;
    if(PlayerInfo[i][profession] == COP) count ++;
}
printf("%d", count); //Will return the # of cops.



Re: count cops online - aNdReSk - 15.07.2010

Thanks a lot Killer