Quote:
Originally Posted by travo
is there a way to detect if the +USE "e" key is press in the plugin_init()?
what i want to do is, have a function called if anyone press the use key. Is there are way to do this in the init with an event or do i have to do it through client_PreThink?
It is only used to trigger my function so i dont need to know if its held and it isnt going to be pressed over and over, so i dont want it to be check excessively.
thanks
|
You need to hook:
register_forward( FM_CmdStart, "CmdStart" )
Code:
public CmdStart( const id, const uc_handle, random_seed )
{
if ( !is_user_alive( id ) )
return FMRES_IGNORED
static buttons
buttons = get_uc( uc_handle, UC_Buttons )
if ( buttons & IN_USE )
// Do something here
buttons &= ~IN_USE // Block them from using perhaps?
set_uc( uc_handle, UC_Buttons, buttons ) // Update buttons then supercede
return FMRES_SUPERCEDE
}
The above method activates when a user actually presses a button and other things.
__________________