[Possible?]Check 'Super sprint' - 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: [Possible?]Check 'Super sprint' (
/showthread.php?tid=368820)
[Possible?]Check 'Super sprint' -
Riddick94 - 14.08.2012
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.
Re: [Possible?]Check 'Super sprint' -
Shetch - 14.08.2012
The only way I imagine doing it is by using a timer and checking if the space bar keeps getting pressed.
Re: [Possible?]Check 'Super sprint' -
Riddick94 - 14.08.2012
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.
Re: [Possible?]Check 'Super sprint' -
Riddick94 - 17.08.2012
Bump.
Re: [Possible?]Check 'Super sprint' -
avivelkayam - 17.08.2012
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"
Re: [Possible?]Check 'Super sprint' -
Riddick94 - 17.08.2012
@****** - 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.