NPC Following players?
#2

You can use timer for getting player's pos
Then set the NPC's pos according to the distance.

Код:
new npctimer;

npctimer = SetTimerEx("NPCFollow", 100, true, "d", playerid); // where you want to start the NPC to follow.

forward NPCFollow(playerid);
public NPCFollow(playerid)
{
   new Float:x, Float:y, Float:z, pName[50];
   if(!IsPlayerNPC(playerid))
   {
     GetPlayerPos(playerid, x, y, z);
   }
   for(new i=0; i<MAX_PLAYERS; i++)
   {
     if(IsPlayerConnected(i) && IsPlayerNPC(i))
     {
        if(GetDistanceBetweenPlayers(playerid, i)<15)
        {
          SetPlayerPos(i, x-2, y, z);
        }
     }
   }
   return 1;
}
Reply


Messages In This Thread
NPC Following players? - by Adam_Hardy - 19.02.2018, 23:08
Re: NPC Following players? - by UFF - 20.02.2018, 00:39
Re: NPC Following players? - by NaS - 20.02.2018, 13:04
Re: NPC Following players? - by Adam_Hardy - 20.02.2018, 22:44
Re: NPC Following players? - by Pottus - 20.02.2018, 23:30
Re: NPC Following players? - by Adam_Hardy - 21.02.2018, 00:57

Forum Jump:


Users browsing this thread: 1 Guest(s)