KEY_SPRINT not detected well like other keys?
#1

Hey there guys, I've made a script based on Seif's walking styles include.
I attempted to use the sprinting key to make a custom animation for certain players when they sprint, but somehow, it doesn't work. Check my script:

pawn Код:
#include a_samp
new SprintTimer[MAX_PLAYERS];
#define TEST_KEY (KEY_SPRINT)
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    if (((newkeys & TEST_KEY && newkeys & KEY_UP) || (newkeys & TEST_KEY && newkeys & KEY_DOWN) || (newkeys & TEST_KEY && newkeys & KEY_LEFT) || (newkeys & TEST_KEY && newkeys & KEY_RIGHT))
    || ((oldkeys & TEST_KEY && newkeys & KEY_UP) || (oldkeys & TEST_KEY && newkeys & KEY_DOWN) || (oldkeys & TEST_KEY && newkeys & KEY_LEFT) || (oldkeys & TEST_KEY && newkeys & KEY_RIGHT))
    || ((newkeys & TEST_KEY && oldkeys & KEY_UP) || (newkeys & TEST_KEY && oldkeys & KEY_DOWN) || (newkeys & TEST_KEY && oldkeys & KEY_LEFT) || (newkeys & TEST_KEY && oldkeys & KEY_RIGHT))
    && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        printf("*hi");
        SprintTimer[playerid] = SetTimerEx("SprintAnim",200,0,"d",playerid);
    }
    return 1;
}
If I do that, "hi" will not be printed and nothing happens. However if I do:
pawn Код:
#define TEST_KEY (KEY_WALK)
It will work correctly when I press the walk key.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)