AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   block in_attack2 (https://forums.alliedmods.net/showthread.php?t=92178)

Dr.G 05-11-2009 09:33

block in_attack2
 
how would you block e.g the in_attack2 key on a client?

ive use prethink and:

PHP Code:

new button pev(id,pev_button)
 
if(
button IN_ATTACK2)
      
set_pev(id,pev_button,button & ~IN_ATTACK2

but i was wondering if theres a better way

minimiller 05-11-2009 09:42

Re: block in_attack2
 
do u want to block it for all weapons?

Arkshine 05-11-2009 09:42

Re: block in_attack2
 
I would use FM_CmdStart instead of prethink.

But a better way would be to set to 9999.0 the offset m_flNextSecondaryAttack
(47) when you deploy a weapon. ( Ham_Item_Deploy )

Dr.G 05-11-2009 19:36

Re: block in_attack2
 
thank you

Hunter-Digital 05-11-2009 20:02

Re: block in_attack2
 
Quote:

Originally Posted by arkshine (Post 825498)
But a better way would be to set to 9999.0 the offset m_flNextSecondaryAttack
(47) when you deploy a weapon. ( Ham_Item_Deploy )

I noticed it resets after the player shoots... you could need to set it again after each shot :?

edit: yep, works perfectly, I also needed this, thanks from me too :P
PHP Code:

RegisterHam(Ham_Item_Deploy"weapon_knife""fwHam_blockSecAttack"1)
RegisterHam(Ham_Weapon_PrimaryAttack"weapon_knife""fwHam_blockSecAttack"1)

public 
fwHam_blockSecAttack(entset_pdata_float(ent479999.0


SnoW 05-12-2009 01:53

Re: block in_attack2
 
How about Ham_Weapon_SecondaryAttack?

Hunter-Digital 05-12-2009 07:59

Re: block in_attack2
 
It's less code, yeah, BUT... the animation still plays while you're holding down the button, in the other method, the attack it's just delayed for 9999 seconds, that means it will never happen :}


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

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