Button Press Detection Issues
So as far as button detection goes, the only two ways I've really found of doing it is through OnPlayerRunCmd and GetEntProp, I'm using GetEntProp in this instance and I want it to do an action when the button is pressed however while testing this it always seems to trigger multiple times or not at all and I'd like to know if there's a different way to accomplish this or if anyone would know the cause.
Here's the bit I'm using Code:
public void OnGameFrame() { |
Re: Button Press Detection Issues
You should be using "OnPlayerRunCmd" why are you using "OnGameFrame" for this?
See here: https://forums.alliedmods.net/showthread.php?t=151142 |
Re: Button Press Detection Issues
Quote:
As Silvers stated you should be using OnPlayerRunCmd. I too had problems with buttons being pressed. I learned that it was best to use OnPlayerRunCmd to check for button presses. I also learned that a single button press will register LOTS of button presses. To fix that I ended up adding a timer to the button press to ensure that the action couldn't occur again for the duration of the timer. In this example the action occurs once and is prevented from occurring again for 3 seconds: PHP Code:
|
Re: Button Press Detection Issues
That worked just fine! Thanks for your help :D I was confused about using OnPlayerRunCmd and you really cleared it up for me. I totally understand why I shouldn't have been using OnGameFrame in that situation, I just didn't know any other way to make use of "m_afButtonPressed".
|
All times are GMT -4. The time now is 05:39. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.