[help] how to stop anims with a key
#1

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
Reply
#2

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

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.
Reply
#4

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..
Reply
#5

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

thanks for help prob fixed. very much appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)