Raised This Month: $51 Target: $400
 12% 

Solved Button Press Detection Issues


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode