Raised This Month: $ Target: $400
 0% 

Ham_Weapon_PrimaryAttack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nextra
Veteran Member
Join Date: Apr 2008
Location: Germany
Old 08-08-2014 , 10:10   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #1

Quote:
Originally Posted by Lycode View Post
That's what I'm trying to avoid.
The engine usually only cares about whether IN_ATTACK is pressed so it can do stuff. There is no special event for letting go of the button. The engine only cares about IN_ATTACK not being set for initiating a reload on empty weapon (Ham_Weapon_Reload), automatically switching from an empty weapon to something else (Ham_Weapon_Deployed/Ham_Weapon_Holstered) and initiating the idle animation (Ham_Weapon_WeaponIdle). You could try experimenting with all of these and try to set up the right configuration to detect what you want. Obviously all of these events are not unique to letting go of the IN_ATTACK button.

Otherwise hooking FM_CmdStart is probably the right solution. It can be hooked on-demand if you would like, by hooking FM_CmdStart in Ham_Weapon_PrimaryAttack and immediately unhooking in FM_CmdStart once the button has been let go by all players.
__________________
In Flames we trust!
Nextra is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-08-2014 , 10:33   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #2

Quote:
Originally Posted by Lycode View Post
For various things. Like drawing a line to where the player is aiming using a TE_BEAMENTPOINT message.
All information regarding your goal is relevant, in particular cases like this where very specific details are the key to making it work.
Relating back to your post using flashbangs, you could do something like this to detect such events:

Code:
#include <amxmodx> #include <hamsandwich> #define FLASHBANG_PULLPIN   1 #define FLASHBANG_THROW     2 public plugin_init() {     RegisterHam( Ham_CS_Weapon_SendWeaponAnim, "weapon_flashbang", "CFlashbang_SendWeaponAnim" ); } public CFlashbang_SendWeaponAnim( iEnt, iAnim ) {     switch( iAnim )     {         case FLASHBANG_PULLPIN:         {             //Attack button pressed by weapon owner         }                 case FLASHBANG_THROW:         {             //Attack button released by weapon owner         }     } }

Of course you would need to also account for weapon holster aswell.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 08-08-2014 , 09:42   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #3

Better hook the CmdStart forward and check for pev_buttons & IN_ATTACK. That's when your player holds the attack button.
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
Lycode
Junior Member
Join Date: Aug 2014
Old 08-08-2014 , 11:42   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #4

Thank you, I'll play around with the options above to see which one works best with what I'm trying to do.
__________________
-This too shall pass
Lycode 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 13:07.


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