SA-MP Forums Archive
[help] how to stop anims with a key - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [help] how to stop anims with a key (/showthread.php?tid=139823)



[help] how to stop anims with a key - iggy1 - 06.04.2010

hello i need a bit of help im still learning pawn(obviously lol) and im stuck with something i need to bind a key in my FS to stop anims, as fire often doesn't clear the anims i have looked on wiki and i thought i found a solution which is:
the define:
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

and the function:

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED( KEY_FIRE | KEY_SPRINT ))
{
ClearAnimations(playerid);
}
return 1;
}
(didn't work)
i know i have probably done something wrong or missed something out i thought this would work it had no errors (been scripting less than a month so go easy on me plz) everyone has to start somewhere.
if u need any additional info to help plz say.
and please i dont wana hear "learn pawn" or "check the wiki", i am trying to learn and i learn mainly from the wiki. thanks for ur time much appreciated



Re: [help] how to stop anims with a key - dice7 - 06.04.2010

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE) || (newkeys & KEY_SPRINT))
    {
        ClearAnimations(playerid);
    }
    return 1;
}



Re: [help] how to stop anims with a key - Rac3r - 06.04.2010

Some animations are really hard to stop.
I tried all these 4 to stop an animation :
pawn Код:
ClearAnimations(playerid);
                SetPlayerSpecialAction(playerid,0);
                TogglePlayerControllable(playerid,true);
The animation was this :
pawn Код:
ApplyAnimation(playerid,"SWAT","swt_wllshoot_in_L",4.1,0,1,1,1,1);
The player has to jump, to clear the animations.


Re: [help] how to stop anims with a key - XCarBOn - 06.04.2010

Quote:
Originally Posted by Rac3r
Some animations are really hard to stop.
I tried all these 4 to stop an animation :
pawn Код:
ClearAnimations(playerid);
                SetPlayerSpecialAction(playerid,0);
                TogglePlayerControllable(playerid,true);
The animation was this :
pawn Код:
ApplyAnimation(playerid,"SWAT","swt_wllshoot_in_L",4.1,0,1,1,1,1);
The player has to jump, to clear the animations.
TogglePlayerControllable(playerid,true); ? This you shouldn't use because the player can unfreeze himself by pressing the key..


Re: [help] how to stop anims with a key - Rac3r - 06.04.2010

You are right and sorry to confuse, I was just saying what won't clear all animations (they will clear most, but not all).


Re: [help] how to stop anims with a key - iggy1 - 06.04.2010

thanks for help prob fixed. very much appreciated.