[Possible?]Check 'Super sprint'
#1

Is there a way to check that player quickly clicks a key running for 'Super-sprint'?

P.S
I'd rather not use a SetTimer/Ex.
Reply
#2

The only way I imagine doing it is by using a timer and checking if the space bar keeps getting pressed.
Reply
#3

Yeah.. just like i tought :/ Okey maybe, someone got an other idea and we'll see if not, i'll do this by Timer, bah.
Reply
#4

Bump.
Reply
#5

you can check the player's speed.
with the stock GetPlayerSpeed

you need to check the speed in "super sprint" and the speed in "regular sprint"
and if the player Reaches the speed of "Super Sprint" he is running in "Super Sprint"
Reply
#6

@****** - Really?
pawn Код:
if(HOLDING(KEY_SPRINT))
    {
        if(!PlayerInfo[playerid][pSprintEnabled])
        {
            PlayerInfo[playerid][pSprintEnabled] = true;
            KillTimer(PlayerInfo[playerid][pSprintTimer]);
            PlayerInfo[playerid][pSprintTimer] = SetTimerEx("CountSprint", SECONDS(1), true, "d", playerid);
        }
        return true;
    }

    if(RELEASED(KEY_SPRINT))
    {
        if(PlayerInfo[playerid][pSprintEnabled])
        {
            if(PlayerInfo[playerid][pSprintCount] < MAX_SPRINT_DEFAULT_VALUE)
            {
                KillTimer(PlayerInfo[playerid][pSprintTimer]);
                PlayerInfo[playerid][pSprintTimer] = SetTimerEx("CountSprint", SECONDS(1), true, "d", playerid);
            }
            PlayerInfo[playerid][pSprintEnabled] = false;
        }
        return true;
    }

    return true;
}

function CountSprint(playerid)
{
    if(PlayerInfo[playerid][pSprintEnabled])
    {
        PlayerInfo[playerid][pSprintCount] -= 1;
        if(PlayerInfo[playerid][pSprintCount] <= 0)
        {
            PlayerInfo[playerid][pSprintCount] = 0;
            PlayerInfo[playerid][pSprintEnabled] = false;
            ApplyAnimation(playerid, "FAT", "IDLE_tired", 4.1, 1, 1, 1, 0, 0, 1);
        }
    }

    else if(!PlayerInfo[playerid][pSprintEnabled])
    {
        PlayerInfo[playerid][pSprintCount] += 1;
        if(PlayerInfo[playerid][pSprintCount] >= MAX_SPRINT_DEFAULT_VALUE)
        {
            ClearAnimations(playerid);
            PlayerInfo[playerid][pSprintCount] = MAX_SPRINT_DEFAULT_VALUE;
            KillTimer(PlayerInfo[playerid][pSprintTimer]);
        }
    }

    new string[64];
    format(string, sizeof(string), "~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~w~Sprint count: %d/%d", PlayerInfo[playerid][pSprintCount], MAX_SPRINT_DEFAULT_VALUE);
    GameTextForPlayer(playerid, string, SECONDS(1), 3);
    return true;
}
Maybe you got some other way to do this..

@avivelkayam - It will be a Timer.. or maybe it can be possible by GetTickCount.. i'll see after MAYBE ****** reply.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)