What I need: only player who shoots from certain guns hear the sound of a gunshot.
PHP Code:
public fw_TraceAttack(iEnt, iAttacker, Float:flDamage, Float:fDir[3], ptr, iDamageType, Float:fVec1[3], Float:fVec2[3])
{
if(!is_user_alive(iAttacker))
return
new g_currentweapon = get_user_weapon(iAttacker)
if(g_currentweapon != CSW_AUG)
return
if(!g_has_ethereal[iAttacker])
return
static Float:flEnd[3]
get_tr2(ptr, TR_vecEndPos, flEnd)
if(!is_user_alive(iEnt))
{
if(eth_mode[iAttacker]==1)
{
Make_BulletHole(iAttacker, flEnd,flDamage)
Make_BulletSmoke(iAttacker, ptr)
emit_sound(iAttacker, CHAN_WEAPON, Laser_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
LaserBeam(iAttacker, flEnd,1, 2,l_ethereal_l_r,l_ethereal_l_g,l_ethereal_l_b,1,1)
}
else
{
#if defined electro_fire_hole
Make_BulletHole(iAttacker, flEnd,flDamage)
#endif
#if defined electro_fire_smoke
Make_BulletSmoke(iAttacker, ptr)
#endif
LaserBeam(iAttacker,flEnd, 1, 2,e_ethereal_l_r,e_ethereal_l_g,e_ethereal_l_b,e_ethereal_ls_min,e_ethereal_ls_max)
emit_sound(iAttacker, CHAN_WEAPON, Electro_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
}
}
I tried something like:
PHP Code:
emit_sound(iAttacker, CHAN_WEAPON, Laser_Sounds[0], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
PHP Code:
client_cmd(iAttacker, "spk %s", Laser_Sounds[0])
I'm interested in is this the correct way to do something like this?