Raised This Month: $ Target: $400
 0% 

Hook button release


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-30-2014 , 22:10   Hook button release
Reply With Quote #1

How can i hook the frame in which a user released a button.
For instance, i was holding +use, i want to hook that frame in which i released the +use key.
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-31-2014 , 01:24   Re: Hook button release
Reply With Quote #2

Check for IN_USE button and see when it stops being used.
__________________
fysiks is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-31-2014 , 02:19   Re: Hook button release
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
Check for IN_USE button and see when it stops being used.
exactly... I was not able to see when it was released so i asked
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-31-2014 , 05:35   Re: Hook button release
Reply With Quote #4

I'm sure there's a pdata offset for this. Checking if button & pev_oldbuttons && !(button & pev_button) is another way though.
Backstabnoob is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-31-2014 , 06:10   Re: Hook button release
Reply With Quote #5

I've one, but it will be checked every frame

PHP Code:
const m_afButtonReleased 247;

static 
iButton iButton get_pdata_int(iIndexm_afButtonReleased5);

if (
iButton IN_USE
__________________
What are you looking for here?
DavidJr is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-31-2014 , 06:41   Re: Hook button release
Reply With Quote #6

ok...
and what is the difference b/w FM_CmdStart and FM_CmdEnd
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 05-31-2014 , 09:58   Re: Hook button release
Reply With Quote #7

I've never seen anyone use FM_CmdEnd, but I'd definitely give it a shot at least.
Backstabnoob is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 05-31-2014 , 13:48   Re: Hook button release
Reply With Quote #8

The difference is that they occur at different positions in time. The pre commands are used to block things. I don't have an official list of what happens but here's an example of how it could look:
Code:
CmdStart
CmdEnd
PreThink
AddToFullPack
PostThink
Or perhaps:
Code:
PreThink
CmdStart
AddToFullPack
CmdEnd
PostThink
In between those different engine functions there could be various things occurring making one better than the other to use in some occasions.
__________________
Black Rose is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 05-31-2014 , 13:48   Re: Hook button release
Reply With Quote #9

From HLSDK:
Quote:
CmdStart

We're about to run this usercmd for the specified player. We can set up groupinfo and masking here, etc.
This is the time to examine the usercmd for anything extra. This call happens even if think does not.
Quote:
CmdEnd

Each cmdstart is exactly matched with a cmd end, clean up any group trace flags, etc. here
So i believe CmdStart is to UserCmd stuff(and probably other movement-related stuff), and CmdEnd follows it, freeing memory and such?
klippy is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-31-2014 , 23:38   Re: Hook button release
Reply With Quote #10

Quote:
Originally Posted by Backstabnoob View Post
Checking if button & pev_oldbuttons && !(button & pev_button) is another way though.
Checking current and old buttons is what I was referring to.
__________________
fysiks is offline
Reply



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 09:47.


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