Raised This Month: $32 Target: $400
 8% 

Detect on Releasing/Holding attack2 button


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 12-02-2017 , 06:20   Detect on Releasing/Holding attack2 button
Reply With Quote #1

Like the title said and I want to it on Ham_Weapon_SecondaryAttack since cmd_start, it mess up with moving button.
__________________
My plugin:

Last edited by Celena Luna; 12-02-2017 at 06:21.
Celena Luna is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-02-2017 , 06:26   Re: Detect on Releasing/Holding attack2 button
Reply With Quote #2

Use pev_oldbuttons and pev_button.
__________________
HamletEagle is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 12-02-2017 , 06:40   Re: Detect on Releasing/Holding attack2 button
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Use pev_oldbuttons and pev_button.
I did you them on FM_CmdStart. They does work but on client side, something the holding got release while moving around.
And I as far as I know if you didn't press the button, you can't execute Ham_Weapon_SecondaryAttack => you can't detect when you release holding it.
__________________
My plugin:

Last edited by Celena Luna; 12-02-2017 at 06:42.
Celena Luna is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 12-04-2017 , 06:23   Re: Detect on Releasing/Holding attack2 button
Reply With Quote #4

the way I managed to detect press / hold / release is by adding a small time tolerance to the mix (something like 200 - 300ms delay and also fault tolerance)

I did this because on my crappy connection, even though I was holding a button, server would occasionally detect as not holding, so when I tried doing something like "charge while holding", it would end prematurely sometimes

checking halflife_time(or gametime), store the value at every check, and only change button state when more than 200ms passed

this happens at prethink


here the if() that is most nested is where I consider button hold being released
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-04-2017 , 08:21   Re: Detect on Releasing/Holding attack2 button
Reply With Quote #5

For -attack2
Check if oldbutton is IN_ATTACK2 && !butto = IN_ATTACK2
__________________
Relaxing 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 05:23.


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