Faster running using animation - 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: Faster running using animation (
/showthread.php?tid=346283)
Faster running using animation -
Fmfan - 27.05.2012
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;
}
Re: Faster running using animation -
CidadeNovaRP - 27.05.2012
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)))
Re: Faster running using animation -
Fmfan - 27.05.2012
Still not working (still keeps running)
Re: Faster running using animation -
CidadeNovaRP - 27.05.2012
Quote:
Originally Posted by Fmfan
Still not working (still keeps running)
|
I edited /\/\
Re: Faster running using animation -
Fmfan - 27.05.2012
Not working again
Re: Faster running using animation -
CidadeNovaRP - 27.05.2012
Quote:
Originally Posted by Fmfan
Not working again 
|
Should be problem with the animation ....
Re: Faster running using animation -
Fmfan - 27.05.2012
Can it be done with velocity instead of animation? (faster running)
EDIT: FIXED!