SA-MP Forums Archive
Animation Help - 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: Animation Help (/showthread.php?tid=639755)



Animation Help - bugmenotlol - 22.08.2017

Код:
if((newkeys & KEY_SPRINT) && !(oldkeys & KEY_SPRINT) )
	{
		if(GetPlayerSkin(playerid) == 99 )
		{
			ApplyAnimation(playerid, "SKATE", "skate_sprint", 4.1, 1, 1, 1, 1, 1, 1);
		}
	}
So i am applying a skating animation. but the problem is when a player releases sprint it should stop and so i tried adding this code to it

Код:
if ((oldkeys & KEY_SPRINT) && !(newkeys & KEY_SPRINT))
	{
		if(GetPlayerSkin(playerid) == 99 )
		{
            ClearAnimations(playerid);
		}
	}
but still it not stopping so how to make this animation when player holding a key ??

Thnx rep


Re: Animation Help - FuNkYTheGreat - 22.08.2017

Put it where your all defines are,
Код:
#define RELEASED(%0) \
	(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
Thanks to SAMP WIKI
and use this one,
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
        if(RELEASED(KEY_SPRINT))
	{
		if(GetPlayerSkin(playerid) == 99 )
		{
                ClearAnimations(playerid);
		}
	}
	return 1;
}