2020-11-10, 04:53 AM
I want to make npc stop following player by distance.
here is my code,
here is my code,
Code:
public FCNPC_Moving(npcid)
{
new Float:p[3];
? ? for(new i =0 ; i < GetMaxPlayers(); i )
{
? ? if(IsPlayerNPC(i)) continue;
FCNPC_GetPosition(npcid,p[0],p[1],p[2]);
if(IsPlayerInRangeOfPoint(i,10,p[0],p[1],p[2]))
{
if(IsPlayerInRangeOfPoint(i,1,p[0],p[1],p[2]))
{
FCNPC_Punch(npcid,p[0],p[1],p[2],50);
}
else
{
? ? FCNPC_GoToPlayer(npcid, i, FCNPC_MOVE_TYPE_AUTO, FCNPC_MOVE_SPEED_AUTO, FCNPC_MOVE_MODE_AUTO, FCNPC_MOVE_PATHFINDING_AUTO, 0.0, true, 0.0, 1.5, 250);
? ? ? ? ? ? ? ??
}
}
}
return 1;
}