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



Check Everyone - breakpaper - 07.07.2011

Hello,

I want to check everyone with a command if someone who's online has PlayerInfo[playerid][pWorking] = 3. But how can i do that? so when someone who's connected has PlayerInfo[playerid][pWorking] = 3, and i do the command: /check, that i get a message that someone is comming, and that 1 random person who has pWorking on 3, gets a message that i need help or something?


Re: Check Everyone - PrawkC - 07.07.2011

You can check everyone by using a for loop, or the foreach include by ****** (ALOT better).
and you'd use the for loop like so..

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
  // In here you use "i" as playerid.
}



Re: Check Everyone - breakpaper - 07.07.2011

@Prawkc,
can you show how it's done with ******?


Re: Check Everyone - Bakr - 07.07.2011

He would be refering to the foreach include created by ******. You can find the topic here: https://sampforum.blast.hk/showthread.php?tid=92679

An example of looping through players with foreach
pawn Код:
foreach(Player, i)
{
   //code
}