Check Everyone
#1

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?
Reply
#2

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.
}
Reply
#3

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

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
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)