Check if any player is near NPC in NPC Mode?
#4

You should be using foreach and not OnPlayerUpdate.

Include YSI\y_timers and foreach and make a new timer

pawn Код:
Timer:UpdatePlayer[250]() {
    foreach(Player, playerid) {
        if(!IsPlayerNPC(playerid)) {
            foreach(Player, npcid) {
                if(IsPlayerNPC(npcid)) {
                    new Float:rPos[3];
                    GetPlayerPos(npcid, rPos[0], rPos[1], rPos[2]);
                    if(IsPlayerInRangeOfPoint(playerid, 8.0, rPos[0], rPos[1], rPos[2])) {
                        OnPlayerNearNPC(playerid, npcid);
                    }
                }
             }
         }
    }
}
After you do that, create a new function called OnPlayerNearNPC.

pawn Код:
OnPlayerNearNPC(playerid, npcid)
{
    // Code inside here
}
Enjoy. This is faster than the one above me.
Reply


Messages In This Thread
Check if any player is near NPC in NPC Mode? - by Programie - 10.03.2010, 18:53
Re: Check if any player is near NPC in NPC Mode? - by kingforyou - 11.03.2010, 21:24
Re : Check if any player is near NPC in NPC Mode? - by timaoux - 28.09.2011, 12:54
Re: Re : Check if any player is near NPC in NPC Mode? - by SuperViper - 28.09.2011, 14:38

Forum Jump:


Users browsing this thread: 1 Guest(s)