View Single Post
SaBBa
Member
Join Date: Dec 2012
Old 02-20-2021 , 15:10   Re: Double button press check
Reply With Quote #2

I might be wrong, but if forward button is pressed twice within 0.5 sec (not required to press them in a row), make_leap func will be executed

PHP Code:
new Float:buttonPressed[33] = 0

public plugin_init()
{
     
register_clcmd("forward""hook_command")
}

public 
hook_command(id)
{
     new 
Float:currentTime get_gametime()
     if(
is_user_bot(id))
          return 
PLUGIN_CONTINUE
     
if((currentTime buttonPressed[id]) < 0.5) {
          
// make_leap(id) or whatever you want
     
} else {
          
buttonPressed[id] = currentTime
     
}
     return 
PLUGIN_CONTINUE

__________________

Last edited by SaBBa; 02-21-2021 at 19:54.
SaBBa is offline