I'm actually doing this:
I hook PrimaryAttack on every weapon (excepting grenades knives and c4) on Pre and Post.
PHP Code:
public fw_Weapon_PrimaryAttack(iWeaponId)
{
g_bWeaponFiring = true
}
public fw_Weapon_PrimaryAttack_Post(iWeaponId)
{
g_bWeaponFiring = false
static iPlayer
iPlayer = get_pdata_cbase(iWeaponId, m_pPlayer, 4)
if(/*HAS BULLETS REMAINING*/)
{
// DECREASE_REMAINING_BULLETS
}
}
g_bWeaponFiring works for catching on TraceAttack the damage caused by bullet. Here I apply the Special bullet effect.
So, the weird thing is that not always when the engine calls PrimaryAttack, a gun is fired. So some special bullets will be lose.
So we're here now. Asking how to know if the gun fired. I think detecting EF_MUZZLEFLASH on player's effect entvar will be a solution.
What do you think?
__________________