View Single Post
Author Message
Ravrob
Junior Member
Join Date: Oct 2019
Location: The Ice
Old 07-05-2020 , 06:45   Button Press Detection Issues
Reply With Quote #1

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() {

	for (int i = 1; i <= MaxClients; i++) {
		if (!IsClientInGame(i) || !IsPlayerAlive(i)) {
			continue;
		}
		
		if(GetEntProp(i, Prop_Data, "m_afButtonReleased") & IN_RELOAD){
			PrintToChat(i, "You pressed the reload key!");
		}
	}
}

Last edited by Ravrob; 07-05-2020 at 22:28.
Ravrob is offline