[Possible?]Check 'Super sprint'
#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


Messages In This Thread
[Possible?]Check 'Super sprint' - by Riddick94 - 14.08.2012, 18:00
Re: [Possible?]Check 'Super sprint' - by Shetch - 14.08.2012, 18:10
Re: [Possible?]Check 'Super sprint' - by Riddick94 - 14.08.2012, 22:20
Re: [Possible?]Check 'Super sprint' - by Riddick94 - 17.08.2012, 10:09
Re: [Possible?]Check 'Super sprint' - by avivelkayam - 17.08.2012, 10:13
Re: [Possible?]Check 'Super sprint' - by Riddick94 - 17.08.2012, 10:16

Forum Jump:


Users browsing this thread: 3 Guest(s)