Raised This Month: $ Target: $400
 0% 

Totally block M4A1's secondary attack.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-04-2009 , 11:18   Totally block M4A1's secondary attack.
Reply With Quote #1

I've tryied to block it,but it sooo buggy, maybe someone can give a code that will block attack2 button(silence).
P.S. Tryied with cmd_start, animations playing pressing attack and attack2,and other bugs...

So can someone give perfect code of blocking attack2 of m4a1?
xbatista is offline
Send a message via Skype™ to xbatista
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2009 , 11:53   Re: Totally block M4A1's secondary attack.
Reply With Quote #2

I don't think you can block the animations as they are client-side.

PHP Code:
register_forwardFM_CmdStart "fw_CmdStart" );

public 
fw_CmdStartClient Handle )
{
    static 
ButtonsButtons get_ucHandle UC_Buttons );

    if( ( 
get_user_weaponClient ) == CSW_M4A1 ) && ( Buttons IN_ATTACK2 ) )
    {
        
Buttons &= ~IN_ATTACK2;
        
set_ucHandle UC_Buttons Buttons );
        
        return 
FMRES_SUPERCEDE;
    }
    
    return 
FMRES_IGNORED;

You can also try this method which will block the animation. It will allow the first one but then all others are blocked. If you set this on the weapon entity before the player uses attack2 then the first will be blocked. I've got to run to work now, if you can't figure out how to do it, I will write it for you later tonight.

PHP Code:
RegisterHamHam_Weapon_SecondaryAttack"weapon_m4a1""fwBlock" );

public 
fwBlock(ent
{
    
set_pdata_floatent 47 9999.0 );

__________________

Last edited by Bugsy; 06-04-2009 at 12:02.
Bugsy is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-04-2009 , 12:16   Re: Totally block M4A1's secondary attack.
Reply With Quote #3

I'm confused, I'll wait
xbatista is offline
Send a message via Skype™ to xbatista
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-04-2009 , 12:18   Re: Totally block M4A1's secondary attack.
Reply With Quote #4

@Bugsy, using the offset, you should use Item_Deploy.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2009 , 22:36   Re: Totally block M4A1's secondary attack.
Reply With Quote #5

Thanks ark

I had to add a hook on primary attack post because apparently using primary attack resets the offset value.

Tested and working
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init() 
{
    
RegisterHamHam_Item_Deploy "weapon_m4a1" "fw_Ham_BlockSilencer" );
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_m4a1""fw_Ham_BlockSilencer" );
}

public 
fw_Ham_BlockSilenceriEnt )
{
    
set_pdata_floatiEnt 47 9999.0 );

__________________

Last edited by Bugsy; 06-04-2009 at 23:10.
Bugsy is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-05-2009 , 01:14   Re: Totally block M4A1's secondary attack.
Reply With Quote #6

Thanks will try when I get back home
xbatista is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-05-2009 , 05:31   Re: Totally block M4A1's secondary attack.
Reply With Quote #7

Omg thats does nothing )))))))))))))))
no effect, m4a1 still can silence
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-05-2009 , 05:39   Re: Totally block M4A1's secondary attack.
Reply With Quote #8

try set_pdata_float( iEnt , 48 , 9999.0 );
not sure about offset

or Ham_Weapon_PrimaryAttack -> Ham_Weapon_SecondaryAttack, tshi will fix when you getting silencer and you again can attack
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-05-2009 , 05:47   Re: Totally block M4A1's secondary attack.
Reply With Quote #9

48 is m_flTimeWeaponIdle.

try :

Code:
    #include <amxmodx>     #include <hamsandwich>     #include <fakemeta>     const m_flNextSecondaryAttack = 47;         public plugin_init()     {         register_plugin( "Block M4A1 Secondary Attack", "1.0", "Amxx Community" );                 RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_m4a1", "Event_BlockSecondaryAttack" , 1 );         RegisterHam( Ham_Item_Deploy , "weapon_m4a1" , "Event_BlockSecondaryAttack", 1 );     }     public Event_BlockSecondaryAttack ( const Entity )     {         set_pdata_float( Entity , m_flNextSecondaryAttack , 9999.0, 4 );     }
__________________
Arkshine is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 06-05-2009 , 05:47   Re: Totally block M4A1's secondary attack.
Reply With Quote #10

okeyews
xbatista is offline
Send a message via Skype™ to xbatista
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 14:02.


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