27.05.2012, 21:39
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:
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;
}