20.02.2018, 00:39
You can use timer for getting player's pos
Then set the NPC's pos according to the distance.
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; }