Keys State Help
#6

Quote:
Originally Posted by git
Посмотреть сообщение
PHP код:
#include <a_samp>
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new 
timesJump[MAX_PLAYERS];
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    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.1011015001);
    
timesJump[playerid] = 0;
    return 
1;

Thank you for helping although this doesn't work for me. I want something like on sampdm.
Reply


Messages In This Thread
Keys State Help - by Istrator - 29.04.2018, 15:10
Re: Keys State Help - by RedRex - 29.04.2018, 15:14
Re: Keys State Help - by Loinal - 29.04.2018, 15:16
Re: Keys State Help - by Pottus - 29.04.2018, 16:34
Re: Keys State Help - by git - 29.04.2018, 19:05
Re: Keys State Help - by Istrator - 30.04.2018, 11:43
Re: Keys State Help - by jasperschellekens - 30.04.2018, 14:21
Re: Keys State Help - by git - 30.04.2018, 14:43

Forum Jump:


Users browsing this thread: 3 Guest(s)