button command combination detection
Most of us know that some buttons are pev_buttons & BUTTON ... But how we can detect if client used for example:
"-duck;+jump" in one frame. I mean, how can we detect what was typed first? |
Re: button command combination detection
You can't know which one was typed first. But it's very unlikely someone can press buttons that fast, considering most people have around 100fps, the player would have to change buttons in 10ms. Try doing some testing, loggin buttons and check if you really can do it in a single frame.
|
Re: button command combination detection
alias do_the_cmd "-duck;+jump"
bind X do_the_cmd |
Re: button command combination detection
Maybe, after the player used the "do_the_cmd" alias, IN_DUCK(-duck) is now in pev_oldbuttons and IN_JUMP(+jump) is in pev_buttons?
If so, you will have to check the time that has passed between both buttons. If it's below 1.0, he used both at the same time. |
Re: button command combination detection
Command is passed in one frame in one and the same time. That's how well known kreedz jumping technique called jumpbug works. There is no delay - everything happens in one player think event.
|
Re: button command combination detection
Quote:
|
Re: button command combination detection
I need to check was it "-duck;+jump" or "+jump;-duck". WHAT WAS THE COMBINATIONS?
P.S. In Ham_Player_Jump pev_flags in both cases contain FL_DUCKING . |
Re: button command combination detection
Quote:
|
Re: button command combination detection
When -duck will be called in that frame we wont have ham_player_duck anyway. When +jump will be called in that frame ham_player_jump will be called, so we wont have any combination...
But somehow engine detects that! You can even test that like this: "+duck;wait;-duck;+jump;wait;-jump" - will end in result that player will double duck. "+duck;wait;+jump;-duck;wait;-jump" - will end in result that player will jump. |
| All times are GMT -4. The time now is 09:10. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.