SA-MP Forums Archive
Cant stop ApplyAnimation function. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cant stop ApplyAnimation function. (/showthread.php?tid=544904)



Cant stop ApplyAnimation function. - scout322 - 04.11.2014

Hi, i have a problem with my script, and i have no idea how to make it work. I have tryd lots of thing's.
I cant stop my crry_prtial animation.
If you know how to do it, please help.

Код:
	if(CP[playerid] == 5003)
	{
		new string[128];
		if(IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You already have a rock.");
		IsRockLoded[playerid] = 1;
		Factoryrocks --;
		DisablePlayerCheckpoint(playerid);
		SetPlayerCheckpoint(playerid, 2334.2183,-2287.3057,13.5469, 1);
		Delete3DTextLabel(Factorytext);
		format(factorystring1, sizeof(string), "Factory : %d crates left.",Factoryrocks);
		Factorytext = Create3DTextLabel(factorystring1,COLOR_YELLOW,2333.4788,-2305.4575,13.5469, 70 , 0 , 1);
		SetPlayerAttachedObject( playerid, 9, 1575, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000 );
		ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 1, 1, 1, 1, 1);
		CP[playerid] = 5004;
		return 1;
	}
	if(CP[playerid] == 5004)
	{
		new string[128];
		if(!IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You have no rocks in your hand.");
		IsRockLoded[playerid] = 0;
		WCraterocks += 1;
		DisablePlayerCheckpoint(playerid);
		SetPlayerCheckpoint(playerid, 2335.0559,-2304.5198,13.5469, 1);
		Delete3DTextLabel(WCratetext);
		format(wcratestring1, sizeof(string), "Factory : %d gun crates left.", WCraterocks);
		WCratetext = Create3DTextLabel(wcratestring1,COLOR_YELLOW,2335.4771,-2284.5957,14.4755, 70 , 0 , 1);
		RemovePlayerAttachedObject(playerid, 9);
		ClearAnimations(playerid);
		CP[playerid] = 5003;
		return 1;
	}
+ form me if you know how to do this..


Re: Cant stop ApplyAnimation function. - scout322 - 05.11.2014

No help ?


Re: Cant stop ApplyAnimation function. - Dziugsas - 05.11.2014

pawn Код:
if(CP[playerid] == 5003)
    {
        new string[128];
        if(IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You already have a rock.");
        IsRockLoded[playerid] = 1;
        Factoryrocks --;
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, 2334.2183,-2287.3057,13.5469, 1);
        Delete3DTextLabel(Factorytext);
        format(factorystring1, sizeof(string), "Factory : %d crates left.",Factoryrocks);
        Factorytext = Create3DTextLabel(factorystring1,COLOR_YELLOW,2333.4788,-2305.4575,13.5469, 70 , 0 , 1);
        SetPlayerAttachedObject( playerid, 9, 1575, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000 );
        ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 1, 1, 1);
        CP[playerid] = 5004;
        return 1;
    }
    if(CP[playerid] == 5004)
    {
        new string[128];
        if(!IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You have no rocks in your hand.");
        IsRockLoded[playerid] = 0;
        WCraterocks += 1;
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, 2335.0559,-2304.5198,13.5469, 1);
        Delete3DTextLabel(WCratetext);
        format(wcratestring1, sizeof(string), "Factory : %d gun crates left.", WCraterocks);
        WCratetext = Create3DTextLabel(wcratestring1,COLOR_YELLOW,2335.4771,-2284.5957,14.4755, 70 , 0 , 1);
        RemovePlayerAttachedObject(playerid, 9);
        ClearAnimations(playerid);
        CP[playerid] = 5003;
        return 1;
    }
try now.And check this https://sampwiki.blast.hk/wiki/ApplyAnimation
You looped you animation.


Re: Cant stop ApplyAnimation function. - scout322 - 05.11.2014

Nope that didnt help. It removes the attachedObject but doesnt clear the animations..


Re: Cant stop ApplyAnimation function. - Simeon87 - 05.11.2014

Код:
if(CP[playerid] == 5003)
{
	new string[128];
	if(IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You already have a rock.");
	IsRockLoded[playerid] = 1;
	Factoryrocks --;
	DisablePlayerCheckpoint(playerid);
	SetPlayerCheckpoint(playerid, 2334.2183,-2287.3057,13.5469, 1);
	Delete3DTextLabel(Factorytext);
	format(factorystring1, sizeof(string), "Factory : %d crates left.",Factoryrocks);
	Factorytext = Create3DTextLabel(factorystring1,COLOR_YELLOW,2333.4788,-2305.4575,13.5469, 70 , 0 , 1);
	SetPlayerAttachedObject( playerid, 9, 1575, 1, -0.064613, 0.520760, 0.000000, 0.000000, 84.217391, 0.000000, 1.000000, 1.000000, 1.000000 );
	ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 1, 1, 0);
	CP[playerid] = 5004;
	
	return 1;
}
else if(CP[playerid] == 5004)
{
	new string[128];
	if(!IsRockLoded[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You have no rocks in your hand.");
	IsRockLoded[playerid] = 0;
	WCraterocks += 1;
	DisablePlayerCheckpoint(playerid);
	SetPlayerCheckpoint(playerid, 2335.0559,-2304.5198,13.5469, 1);
	Delete3DTextLabel(WCratetext);
	format(wcratestring1, sizeof(string), "Factory : %d gun crates left.", WCraterocks);
	WCratetext = Create3DTextLabel(wcratestring1,COLOR_YELLOW,2335.4771,-2284.5957,14.4755, 70 , 0 , 1);
	RemovePlayerAttachedObject(playerid, 9);
	ClearAnimations(playerid);
	TogglePlayerControllable(playerid, 1);
	CP[playerid] = 5003;
	
	return 1;
}
http://pastebin.com/axCBMkjF

Changes
1. Line 13 - forcesync parameter of ApplyAnimation set to 0.
2. Line 31 - "TogglePlayerControllable(playerid, 1);" added.

If you don't require the forcesync parameter to be 1, this should do the trick!
Line 31 is required as the freeze parameter actually works when forcesync is off.

Best regards.


Re: Cant stop ApplyAnimation function. - scout322 - 05.11.2014

I got it working by just replacing ClearAnimations(playerid); with ApplyAnimation(playerid,"CARRY","crry_prtial",4.0, 0,0,0,0,1,0);
But still it doesn't stop the anim all the time.

p.s thx for help mate, it worked well now.


Re: Cant stop ApplyAnimation function. - Simeon87 - 06.11.2014

No problem at all Scout.