SA-MP Forums Archive
(help) sprint key bug - 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) sprint key bug (/showthread.php?tid=214695)



(help) sprint key bug - Amine_Mejrhirrou - 21.01.2011

hi all
my problem is when i press sprint key the player start sprint & even if take my finger out the key he still sprinting
can some one show me can i change that to make the player sprint only if he HOLD THE KEY pls
this is the code that i'm using
Код:
	if((newkeys & KEY_SPRINT) && (team[playerid] == 2))
	{
		ApplyAnimation(playerid,"MUSCULAR","MuscleSprint",100000.1,1,1,1,1,1,1);
		return 1;
    }



Re: (help) sprint key bug - Stylock - 21.01.2011

This should do the trick
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys < oldkeys)
    {
        if(oldkeys - newkeys == KEY_SPRINT)
        {
            ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
        }
    }
    else
    {
        if(newkeys - oldkeys == KEY_SPRINT)
        {
            ApplyAnimation(playerid,"MUSCULAR", "MuscleSprint", 4.0, 1, 1, 1, 1, 1, 1);
        }
    }
    return 1;
}



Re : (help) sprint key bug - Amine_Mejrhirrou - 22.01.2011

thanks a lot
works