Today i'm gonna show you is how to replace a weapon's firing sound, without having to rewrite a lot of stuff..
I know this has been discussed around here and no one offered any solution that didn't involve rewriting a lot of the weapon's functions, so i am here to offer you an alternative
I am a lazy and inpatient person, so i'm gonna jump right to it, if anyone wants to rewrite the tutorial he is welcome..
PHP Code:
new gi_TempClip
public plugin_init()
{
register_plugin("Plugin", "1.0", "Author")
// Hooking weapon primary attack
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "hook_weaponattack_pre", 0)
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "hook_weaponattack_post", 1)
}
public hook_weaponattack_pre(iWeapon)
{
new iWeaponClip = get_pdata_int(iWeapon, 51, 4)
gi_TempClip = iWeaponClip
}
public hook_weaponattack_post(iWeapon)
{
new iPlayer = get_pdata_cbase(iWeapon, 41, 4)
new iWeaponClip = get_pdata_int(iWeapon, 51, 4)
if(gi_TempClip > iWeaponClip)
{
switch(random_num(0, 1))
{
case 0: emit_sound(iPlayer, CHAN_WEAPON, "weapons/famas-1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
case 1: emit_sound(iPlayer, CHAN_WEAPON, "weapons/famas-2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
}
}
}
__________________