 |
|
Senior Member
Join Date: Dec 2011
Location: Yuen Long Country
|

09-07-2012
, 03:53
Re: How to catch holding fire button
|
#6
|
Quote:
Originally Posted by ConnorMcLeod
Ripped from CBasePlayer:  reThink, should work.
PHP Code:
#include <amxmodx> #include <fakemeta>
#define m_afButtonLast 245
public plugin_init() { register_forward(FM_CmdStart, "OnCmdStart", false) }
public OnCmdStart(id, cmd) { static buttons, buttonsChanged, buttonPressed, buttonReleased buttons = get_uc(cmd, UC_Buttons)
buttonsChanged = get_pdata_int(id, m_afButtonLast) ^ buttons
buttonPressed = buttonsChanged & buttons buttonReleased = buttonsChanged & ~buttons
if( buttonPressed & IN_ATTACK ) { // just pressed +attack } else if( buttonReleased & IN_ATTACK ) { // just released +attack } }
|
Nice ConnorMcLeod, i love your coding
Last edited by 11922911; 09-07-2012 at 03:54.
|
|
|
|