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

Ham_Weapon_PrimaryAttack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lycode
Junior Member
Join Date: Aug 2014
Old 08-06-2014 , 15:40   Ham_Weapon_PrimaryAttack
Reply With Quote #1

Is it possible to detect -attack in Ham_Weapon_PrimaryAttack?

get_pdata_int(id, m_afButtonReleased, XO_CBASEPLAYER) & IN_ATTACK is not working for me.

If not then what would be the next best option to detect -attack after doing a couple of checks in Ham_Weapon_PrimaryAttack.
__________________
-This too shall pass
Lycode is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 08-06-2014 , 16:27   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #2

Show your code
__________________
alan_el_more is offline
Lycode
Junior Member
Join Date: Aug 2014
Old 08-07-2014 , 13:48   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #3

My first post had sufficient information to answer the question, but:

PHP Code:
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_flashbang""fwd_flashbang"); 
PHP Code:
public fwd_flashbang(ent)
{
    new 
id get_pdata_cbase(entm_pPlayerXO_CBASEPLAYERITEM);
    if(
get_pdata_int(idm_afButtonReleasedXO_CBASEPLAYER) & IN_ATTACK)
    {
       
client_print(idprint_chat"-attack");
    }

__________________
-This too shall pass
Lycode is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 08-08-2014 , 02:30   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #4

What do you want to check exactly?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Lycode
Junior Member
Join Date: Aug 2014
Old 08-08-2014 , 05:05   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #5

Within the Ham_Weapon_PrimaryAttack forward, I'm checking if the player released their attack key. Is that even possible as the forward is called when you're holding down attack?

If that is not possible, what would be my best option? Efficiency wise.
__________________
-This too shall pass
Lycode is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-08-2014 , 07:39   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #6

Rather than explaining what you think you need to do ( aka. the XY Problem ) to solve your problem, explain what you are actually trying to achieve in the end.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
PreDominance
Member
Join Date: Jul 2014
Old 08-08-2014 , 08:13   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #7

Isn't it possible to just hook the -attack clcmd?
PreDominance is offline
Lycode
Junior Member
Join Date: Aug 2014
Old 08-08-2014 , 09:35   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #8

Quote:
Originally Posted by hornet View Post
Rather than explaining what you think you need to do ( aka. the XY Problem ) to solve your problem, explain what you are actually trying to achieve in the end.
I'm setting a bool to true when the player is holding down their attack button while holding a grenade. I would like to set it to false when they release the button, not when the grenade is thrown. Is that possible through Ham_Weapon_PrimaryAttack?

Quote:
Originally Posted by PreDominance View Post
Isn't it possible to just hook the -attack clcmd?
Nope.
__________________
-This too shall pass
Lycode is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 08-08-2014 , 09:42   Re: Ham_Weapon_PrimaryAttack
Reply With Quote #9

Quote:
Originally Posted by Lycode View Post
I'm setting a bool to true when the player is holding down their attack button while holding a grenade. I would like to set it to false when they release the button, not when the grenade is thrown
Read my post again. For what purpose is this going to be used?
__________________
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 #10

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
Reply


Thread Tools
Display Modes

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 11:42.


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