Hey :D
I'm trying to change the sound when we hit the zombie with my extra item, but is not sending anything. I'm using the following code:
Code:
RegisterHam(Ham_TakeDamage, "weapon_knife", "Ham_Player_TakeDamage");
public Ham_Player_TakeDamage(victim, inflictor, attacker, Float:damage)
{
if (!is_user_alive(attacker) || get_user_weapon(attacker) != CSW_KNIFE) return HAM_IGNORED;
emit_sound(id, CHAN_WEAPON, "weapons/hit.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
client_print(attacker, print_center, "DAMAGE!");
return HAM_IGNORED;
}
Taking advantage of this topic, another problem is occurring with the Ham_Item_Deploy. I put it to emit a sound when the Player use the gun, but the sound is emitting more than once. The code is as follows:
Code:
RegisterHam(Ham_Item_Deploy, "weapon_knife", "Ham_ItemDeploy_Post", 1);
public Ham_ItemDeploy_Post(iEntity)
{
if (!pev_valid(iEntity)) return HAM_IGNORED;
new id = get_pdata_cbase(iEntity, 41, 4);
if (!is_user_alive(id) || g_has_item[id]) return HAM_IGNORED;
emit_sound(id, CHAN_WEAPON, "weapons/draw.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM);
return HAM_IGNORED;
}
__________________