OnPlayerSprint?
#7

Quote:
Originally Posted by d1git
Посмотреть сообщение
Could this work?

PHP код:
new sprint[MAX_PLAYERS];
// PRESSING(keyVariable, keys)
#define PRESSED(%0) \
    
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
// RELEASED(keys)
#define RELEASED(%0) \
    
(((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0))) 
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_SPRINT))
    {
        
sprint[playerid] = 1// Player pressed the sprint key
    
}
    if(
RELEASED(KEY_SPRINT))
    {
        
sprint[playerid] = 0// Player letgo of the sprint key
    
}
    return 
1;

Pretty simple really - but I would use the method Pottus explained.

EDIT: Typo.

EDIT2: Just tested this in-game, it does work.
giving me an error "undefined symbol PRESSED" also tried to change it to "PRESSING" but still the same error
Reply


Messages In This Thread
OnPlayerSprint? - by Lirbo - 17.01.2016, 17:30
Re: OnPlayerSprint? - by PrO.GameR - 17.01.2016, 17:36
Re: OnPlayerSprint? - by Lirbo - 17.01.2016, 17:41
Re: OnPlayerSprint? - by Pottus - 17.01.2016, 18:14
Re: OnPlayerSprint? - by -CaRRoT - 17.01.2016, 18:55
Re: OnPlayerSprint? - by d1git - 17.01.2016, 18:59
Re: OnPlayerSprint? - by Lirbo - 17.01.2016, 19:11
Re: OnPlayerSprint? - by d1git - 17.01.2016, 19:13
Re: OnPlayerSprint? - by Lirbo - 17.01.2016, 19:25
Re: OnPlayerSprint? - by d1git - 17.01.2016, 19:27

Forum Jump:


Users browsing this thread: 3 Guest(s)