Quote:
Originally Posted by git
PHP код:
#include <a_samp>
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new timesJump[MAX_PLAYERS];
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(!IsPlayerInAnyVehicle(playerid))
{
new firstjumpTime;
if(PRESSED(KEY_JUMP))
{
timesJump[playerid]++;
if(timesJump[playerid] == 1)
{
firstjumpTime = gettime()+4500;
return 1;
}
if(timesJump[playerid] > 3)
{
timesJump[playerid] = 0;
if(firstjumpTime < gettime())
{
OnPlayerJumpThreeTimes(playerid);
}
}
return 1;
}
}
return 1;
}
forward public OnPlayerJumpThreeTimes(playerid);
public OnPlayerJumpThreeTimes(playerid)
{
SendClientMessage(playerid, -1, "detected jumping 3 times within timespan of 4.5 seconds");
// the code when the player jumps three times
ApplyAnimation(playerid, "GYMNASIUM", "gym_tread_falloff", 4.1, 0, 1, 1, 0, 1500, 1);
timesJump[playerid] = 0;
return 1;
}
|
Thank you for helping although this doesn't work for me. I want something like on sampdm.