Actor walking. (Pet system)
#1

I'm making a pet system with actor. I want to do "/petfollow" command but I couldn't. Can anyone help me? Codes're here.

Код:
CMD:actorolustur(playerid)
{
	new Float:pos[4];
	GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
	GetPlayerFacingAngle(playerid,pos[3]);
	ActorPet = CreateActor(311,pos[0],pos[1],pos[2],pos[3]);
	return 1;
}
Код:
CMD:gel(playerid)
{
        SetTimerEx("MoveActor",1,true,"i",playerid,ActorPet);
	return 1;
}
Код:
forward MoveActor(playerid,id);
public MoveActor(playerid,id)
{
	if(IsValidActor(id))
 	{
 	    new Float:x,Float:y,Float:z,Float:angle;
		new Float:playerx,Float:playery,Float:playerz;
		GetPlayerPos(playerid,playerx,playery,playerz);
		GetActorPos(id,x,y,z);
		ApplyActorAnimation(id,"ped","run_player",4.1,1,1,1,0,0);
		ApplyActorAnimation(id,"ped","run_player",4.1,1,1,1,0,0);
		SetActorLookAt(id,playerx,playery);
		GetActorFacingAngle(id,angle);
		x += 0.01 * floatsin(-angle, degrees);
		y += 0.01 * floatcos(-angle, degrees);
		new Float:yeniz;
		MapAndreas_FindZ_For2DCoord(x,y,yeniz);
		SetActorPos(id x, y, yeniz+1);
	}
	
	return 1;
}
Код:
stock SetActorLookAt(actorid, Float:X, Float:Y)
{
	new Float:Px, Float:Py, Float: Pa;
	GetActorPos(actorid, Px, Py, Pa);
	Pa = floatabs(atan((Y-Py)/(X-Px)));
	if (X <= Px && Y >= Py) Pa = floatsub(180, Pa);
	else if (X < Px && Y < Py) Pa = floatadd(Pa, 180);
	else if (X >= Px && Y <= Py) Pa = floatsub(360.0, Pa);
	Pa = floatsub(Pa, 90.0);
	if (Pa >= 360.0) Pa = floatsub(Pa, 360.0);
	SetActorFacingAngle(actorid, Pa);
}
I found these codes in a Turkish pawn forum.
My variables are:

Код:
"PlayerInfo[playerid][pPet]"
"PlayerInfo[playerid][pPetStatus]"
"PlayerInfo[playerid][pPetText]"
"PlayerInfo[playerid][pPetName]"
If I can make this pet system, I will share it.
Reply


Messages In This Thread
Actor walking. (Pet system) - by darkwing - 30.06.2018, 18:25
Re: Actor walking. (Pet system) - by Dayrion - 30.06.2018, 18:37
Re: Actor walking. (Pet system) - by darkwing - 30.06.2018, 18:45
Re: Actor walking. (Pet system) - by Verc - 30.06.2018, 18:55
Re: Actor walking. (Pet system) - by darkwing - 30.06.2018, 19:06
Re: Actor walking. (Pet system) - by Dayrion - 30.06.2018, 20:53
Re: Actor walking. (Pet system) - by darkwing - 30.06.2018, 21:39
Re: Actor walking. (Pet system) - by darkwing - 02.07.2018, 07:04

Forum Jump:


Users browsing this thread: 1 Guest(s)