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



OnPlayerUpdate - Skream - 28.12.2014

OnPlayerUpdate is called just for players or npcs too?


Re: OnPlayerUpdate - xeon_inside - 28.12.2014

Just for players but if you want to use NPCs you must use the function ·IsPlayerNPC·

Example:

pawn Код:
public OnPlayerUpdate(playerid)
{
   SendClientMessage(playerid,-1,"Hello , this message will show each 1 second,");
   // This will show only to the player
   return true;
}
But if you want to do something with NPCs just use a restriction

pawn Код:
public OnPlayerUpdate(playerid)
{
   if(IsPlayerNPC(playerid))
   {
      // do something to NPCs
   }
   else
   {
      // do something to players
   }
   return true;
}