View Single Post
Old 21/09/2018, 02:21 PM   #7
matje
Little Clucker
 
Join Date: Sep 2016
Posts: 31
Reputation: 5
Default Re: NPC chase the nearest player

Quote:
Originally Posted by NaS View Post
Could you post the related code? Otherwise we have to guess what could be the cause
Sorry about that, you are right

Code:
for(new i=0; i < MAX_PLAYERS; i++){
	    new Float:xp, Float: yp, Float: zp;
	    GetPlayerPos(playerid, xp, yp, zp);
        for(new iz = 0; iz < WaveZombies; iz++){
    		if(FCNPC_IsValid(Zombies[iz])){
		        if(IsPlayerInRangeOfPoint(Zombies[iz], 10, xp, yp, zp)){
		             FCNPC_GoToPlayer(Zombies[iz], playerid, FCNPC_MOVE_TYPE_RUN, FCNPC_MOVE_SPEED_RUN, false, 0.0, true, 0.0, 1.5, 250);
matje is offline   Reply With Quote