open.mp forum
[Pawn] Help with FCNPC - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Help with FCNPC (/showthread.php?tid=1328)



Help with FCNPC - dwp12345 - 2020-11-10

I want to make npc stop following player by distance.



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;

}



RE: Help with FCNPC - dwp12345 - 2020-11-10

Solved