[Plugin] PathFinder by Pamdex
#13

Ok. I'll see what's wrong in code...

Test this code (without "clear"):
Code:
#include <a_samp>
#include <PathFinder>
#include <rnpc>
new zombie_moved[5];
new zombie_timer;
public OnPathCalculated(routeid,success,nodes[],nodes_size)
{
	if(success)
	{
		new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1;
		RNPC_CreateBuild(routeid,PLAYER_RECORDING_TYPE_ONFOOT);
		//Bot!
		for(new i; i < nodes_size-1; i++)
		{
			PathFinder_GetNodePos(nodes[i],x,y,z);
			PathFinder_GetNodePos(nodes[i+1],x1,y1,z1);
			RNPC_AddMovement(x,y,z+1,x1,y1,z1+1,RNPC_SPEED_RUN); //crappy :D
		}
		RNPC_FinishBuild();
		RNPC_StartBuildPlayback(routeid);
	}
	else
	{
		new text[126];
		format(text,sizeof(text),"Zombie: %d failed!",routeid);
		SendClientMessageToAll(-1,text);
		zombie_moved[routeid] = true;
	}
	return 1;
}
public OnFilterScriptInit()
{
	PathFinder_Init(1.0);
	ConnectRNPC("Zombie1"); //id 0
	ConnectRNPC("Zombie2");
	ConnectRNPC("Zombie3");
	ConnectRNPC("Zombie4");
	ConnectRNPC("Zombie5");
	return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
	if(!strcmp("/zombie_spawn",cmdtext,true))
	{
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		SetPlayerPos(0,x+5,y,z);
		SetPlayerSkin(0,200);
		SetPlayerPos(1,x-5,y,z);
		SetPlayerSkin(1,200);
		SetPlayerPos(2,x+5,y+5,z);
		SetPlayerSkin(2,200);
		SetPlayerPos(3,x+5,y-5,z);
		SetPlayerSkin(3,200);
		SetPlayerPos(4,x-5,y-5,z);
		SetPlayerSkin(4,200);
		return 1;
	}
	if(!strcmp("/zombie_start",cmdtext,true))
	{
		for(new i=0;i<5;i++)
		{
			zombie_moved[i] = true;
		}
		zombie_timer = SetTimerEx("ZombieRun",1000,1,"d",playerid);
		return 1;
	}
	if(!strcmp("/zombie_stop",cmdtext,true))
	{
		KillTimer(zombie_timer);
		return 1;
	}
	return 0;
}
public OnRNPCPlaybackFinished(npcid)
{
	zombie_moved[npcid] = true;
	return 1;
}
forward ZombieRun(playerid);
public ZombieRun(playerid)
{
	new Float:x,Float:y,Float:z,Float:x1,Float:y1,Float:z1;
	GetPlayerPos(playerid,x1,y1,z1);
	for(new i=0;i<5;i++)
	{
		if(zombie_moved[i])
		{
			GetPlayerPos(i,x,y,z);
			PathFinder_FindWay(i,x,y,x1+random(6)-3,y1+random(6)-3);
			zombie_moved[i] = false;
		}
	}
	return 1;
}
OK! I found problem . I'll fix it soon.

@EDIT! OK fixed Wait a moment for update (max 30 minutes)
Reply


Messages In This Thread
PathFinder by Pamdex - by pamdex - 31.03.2013, 21:28
Re: PathFinder 0.11v by Pamdex - by Pottus - 31.03.2013, 21:34
Re: PathFinder 0.11v by Pamdex - by pamdex - 31.03.2013, 21:50
Re: PathFinder 0.11v by Pamdex - by steki. - 31.03.2013, 21:54
Re: PathFinder 0.11v by Pamdex - by RebeloX - 31.03.2013, 22:42
Re: PathFinder 0.11v by Pamdex - by Pottus - 31.03.2013, 23:12
Respuesta: PathFinder 0.11v by Pamdex - by oOFotherOo - 31.03.2013, 23:19
Re: PathFinder 0.11v by Pamdex - by Lorenc_ - 31.03.2013, 23:34
Re: PathFinder 0.11v by Pamdex - by CoaPsyFactor - 31.03.2013, 23:39
Re: PathFinder 0.11v by Pamdex - by Pottus - 01.04.2013, 00:23
Re: PathFinder 0.11v by Pamdex - by cyber_punk - 01.04.2013, 04:26
Re: PathFinder 0.11v by Pamdex - by Pottus - 01.04.2013, 04:46
Re: PathFinder 0.11v by Pamdex - by pamdex - 01.04.2013, 07:10
Re: PathFinder 0.11v by Pamdex - by RajatPawar - 01.04.2013, 08:09
Re: PathFinder 0.11v by Pamdex - by AIped - 01.04.2013, 08:13
Re: PathFinder 0.12v by Pamdex - by pamdex - 01.04.2013, 08:35
Re: PathFinder 0.11v by Pamdex - by Pottus - 01.04.2013, 09:09
Re: PathFinder 0.11v by Pamdex - by Kyle - 01.04.2013, 09:56
Re: PathFinder 0.11v by Pamdex - by Niko_boy - 01.04.2013, 10:16
Re: PathFinder by Pamdex - by TheArcher - 01.04.2013, 10:44
Re: PathFinder 0.11v by Pamdex - by Lorenc_ - 01.04.2013, 11:42
Re: PathFinder by Pamdex - by Mauzen - 01.04.2013, 13:05
Re: PathFinder by Pamdex - by AIped - 01.04.2013, 15:59
Re: PathFinder by Pamdex - by pamdex - 01.04.2013, 16:38
Re: PathFinder by Pamdex - by AIped - 01.04.2013, 16:52
Re: PathFinder by Pamdex - by pamdex - 01.04.2013, 17:07
Re: PathFinder by Pamdex - by AIped - 02.04.2013, 09:28
Re: PathFinder by Pamdex - by TheArcher - 02.04.2013, 11:57
Re: PathFinder by Pamdex - by pamdex - 02.04.2013, 12:05
Re: PathFinder by Pamdex - by TheArcher - 02.04.2013, 12:13
AW: PathFinder by Pamdex - by Blackazur - 02.04.2013, 12:26
Re: PathFinder by Pamdex - by justinnater - 02.04.2013, 13:02
Re: PathFinder by Pamdex - by DoctorRapist - 02.04.2013, 14:19
Re: PathFinder by Pamdex - by AIped - 02.04.2013, 18:23
Re: PathFinder by Pamdex - by TheArcher - 02.04.2013, 18:57
Re: PathFinder by Pamdex - by pamdex - 02.04.2013, 19:07
Re: PathFinder by Pamdex - by Pottus - 02.04.2013, 23:14
Re: PathFinder by Pamdex - by Gamer_Z - 03.04.2013, 00:15
Re: PathFinder by Pamdex - by Kar - 03.04.2013, 01:11
Re: PathFinder by Pamdex - by Pottus - 03.04.2013, 01:28
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 06:54
Re: PathFinder by Pamdex - by Gamer_Z - 03.04.2013, 07:00
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 08:21
Re: PathFinder by Pamdex - by Babul - 03.04.2013, 10:07
Re: PathFinder by Pamdex - by Pottus - 03.04.2013, 11:23
Re: PathFinder by Pamdex - by TheArcher - 03.04.2013, 11:39
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 12:00
Re: PathFinder by Pamdex - by [FSaF]Jarno - 03.04.2013, 13:00
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 13:05
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 13:09
Re: PathFinder by Pamdex - by Y_Less - 03.04.2013, 13:39
Re: PathFinder by Pamdex - by AIped - 03.04.2013, 13:53
Re: PathFinder by Pamdex - by pamdex - 03.04.2013, 13:58
Re: PathFinder by Pamdex - by Y_Less - 03.04.2013, 14:02
Re: PathFinder by Pamdex - by Pottus - 03.04.2013, 14:23
Re: PathFinder by Pamdex - by smiiir - 03.04.2013, 15:30
Re: PathFinder by Pamdex - by TheArcher - 03.04.2013, 16:49
Re: PathFinder by Pamdex - by pamdex - 18.04.2013, 13:16
Re: PathFinder by Pamdex - by iMads - 23.04.2013, 11:50
Re: PathFinder by Pamdex - by PT - 23.04.2013, 11:54
Re: PathFinder by Pamdex - by Y_Less - 23.04.2013, 12:06
Re: PathFinder by Pamdex - by Gamer_Z - 23.04.2013, 12:51
Re: PathFinder by Pamdex - by pamdex - 28.04.2013, 18:55
Re: PathFinder by Pamdex - by Mauzen - 04.08.2014, 22:16
Re: PathFinder by Pamdex - by pamdex - 05.08.2014, 00:03
Re: PathFinder by Pamdex - by pamdex - 15.10.2014, 20:34
Re: PathFinder by Pamdex - by Pottus - 15.10.2014, 20:36
Re: PathFinder by Pamdex - by RiqueP - 15.10.2014, 23:06
Re: PathFinder by Pamdex - by pamdex - 19.10.2014, 17:23
Re: PathFinder by Pamdex - by iFarbod - 19.10.2014, 17:57
Re: PathFinder by Pamdex - by pamdex - 19.10.2014, 18:00
Re: PathFinder by Pamdex - by iFarbod - 19.10.2014, 18:39
Re: PathFinder by Pamdex - by Mauzen - 19.10.2014, 18:44
Re: PathFinder by Pamdex - by Riddick94 - 19.10.2014, 19:44
Re: PathFinder by Pamdex - by Mauzen - 19.10.2014, 21:33
Re: PathFinder by Pamdex - by Mauzen - 27.10.2014, 21:42
Re: PathFinder by Pamdex - by Mauzen - 28.10.2014, 01:13
Re: PathFinder by Pamdex - by pamdex - 12.11.2014, 09:42
Re: PathFinder by Pamdex - by Mauzen - 17.11.2014, 17:40
Re: PathFinder by Pamdex - by Crayder - 24.11.2014, 23:43
Re: PathFinder by Pamdex - by Pottus - 25.11.2014, 00:21
Re: PathFinder by Pamdex - by juank - 25.11.2014, 05:02
Re: PathFinder by Pamdex - by pamdex - 24.03.2015, 20:47
Re: PathFinder by Pamdex - by KayJ - 25.03.2015, 03:59
Re: PathFinder by Pamdex - by pamdex - 11.05.2015, 13:58
Re: PathFinder by Pamdex - by Pottus - 11.05.2015, 18:06
Re: PathFinder by Pamdex - by AIped - 11.05.2015, 18:15
Re: PathFinder by Pamdex - by pamdex - 17.05.2015, 17:10
Re: PathFinder by Pamdex - by n0minal - 17.05.2015, 17:13
Re: PathFinder by Pamdex - by liinor - 23.12.2015, 21:40
Re: PathFinder by Pamdex - by pamdex - 26.12.2015, 21:59
Re: PathFinder by Pamdex - by Stump - 14.04.2016, 08:44
Re: PathFinder by Pamdex - by pamdex - 15.04.2016, 16:46
Re: PathFinder by Pamdex - by Stump - 15.04.2016, 17:08
Re: PathFinder by Pamdex - by pamdex - 15.04.2016, 17:26
Re: PathFinder by Pamdex - by Stump - 15.04.2016, 17:37
Re: PathFinder by Pamdex - by Stump - 23.04.2016, 07:50
Re: PathFinder by Pamdex - by pamdex - 23.04.2016, 09:42
Re: PathFinder by Pamdex - by Stump - 23.04.2016, 11:54
Re: PathFinder by Pamdex - by pamdex - 23.04.2016, 19:39
Re: PathFinder by Pamdex - by Stump - 24.04.2016, 06:59
Re: PathFinder by Pamdex - by ExTaZZ69 - 24.04.2016, 19:47
Re: PathFinder by Pamdex - by Skream - 26.09.2017, 13:59
Re: PathFinder by Pamdex - by MrStead - 30.07.2018, 19:12
Re: PathFinder by Pamdex - by tandytanz - 26.12.2018, 11:29
Re: PathFinder by Pamdex - by pamdex - 12.01.2019, 14:02
Re: PathFinder by Pamdex - by Pottus - 12.01.2019, 18:54
Re: PathFinder by Pamdex - by Crayder - 12.01.2019, 21:28
Re: PathFinder by Pamdex - by Pottus - 12.01.2019, 23:26
Re: PathFinder by Pamdex - by MrStead - 16.01.2019, 16:53

Forum Jump:


Users browsing this thread: 1 Guest(s)