Faster running using animation
#1

Hi, I'm trying to make certain team able to run faster then others (using animation) when they hold sprint button (space)
The problem is I can't make them stop when I release sprint button, they just continue running even though I'm not holding any button

Codes:
pawn Код:
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
pawn Код:
if (HOLDING( KEY_SPRINT ))
{
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { return 1; }
    ApplyAnimation(playerid,"MUSCULAR","MuscleSprint",4.0,1,1,1,1,1);
    return 1;
}
else if (RELEASED( KEY_SPRINT ))
{
    if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) { return 1; }
    ClearAnimations(playerid);
    return 1;
}
Reply
#2

Try this:
pawn Код:
if (HOLDING( KEY_SPRINT ))
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        ApplyAnimation(playerid,"MUSCULAR","MuscleSprint",4.0,1,1,1,1,1);
    }
    else
    {
        return 1;
    }
    return 1;
}
else if (RELEASED( KEY_SPRINT ))
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        ClearAnimations(playerid);
    }
    else
    {
        return 1;
    }
    return 1;
}
and
pawn Код:
// HOLDING(keys)
#define HOLDING(%0) \
    ((newkeys & (%0)) == (%0))

// RELEASED(keys)
#define RELEASED(%0) \
    (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0)))
Reply
#3

Still not working (still keeps running)
Reply
#4

Quote:
Originally Posted by Fmfan
Посмотреть сообщение
Still not working (still keeps running)
I edited /\/\
Reply
#5

Not working again
Reply
#6

Quote:
Originally Posted by Fmfan
Посмотреть сообщение
Not working again
Should be problem with the animation ....
Reply
#7

Can it be done with velocity instead of animation? (faster running)


EDIT: FIXED!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)