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);
}
}
__________________