Raised This Month: $ Target: $400
 0% 

Solved Ham_Weapon_SecondaryAttack on elites, for example


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 06-30-2017 , 15:58   Re: Ham_Weapon_SecondaryAttack on elites, for example
Reply With Quote #6

Best way is hooking HasSecondaryAttack as Klippy said, but you also can do it the way how game actually does it too

Code:
public plugin_init()
{
      ....
      RegisterHam(Ham_Item_PostFrame, "weapon_elite", "OnItemPostFrame");
      ....
}

.......

public OnItemPostFrame(weapon)
{
     .... checks here

     static player;
     player = get_ent_data_entity(weapon, "CBasePlayerItem", "m_pPlayer");

     static buttons;
     buttons = pev(player, pev_button, buttons);

     if ((buttons & IN_ATTACK2) && (get_ent_data_float(weapon, "CBasePlayerWeapon", "m_flNextSecondaryAttack") <= 0.0))
     {
          //Your attack goes here
          // Or you can do this ExecuteHamB(Ham_Weapon_SecondaryAttack, weapon);
          set_pev(player, pev_button, buttons &= ~IN_ATTACK2);
     }
}
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
 



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 23:00.


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