Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Sound Blocker"
#define VERSION "1.0"
#define AUTHOR "anakin_cstrike"
new const oldsound[] = "radio/ct_fireinhole.wav";
new const newsound[] = "misc/grenada.wav";
new g_maxplayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_forward( FM_EmitSound, "fw_emitsound" );
g_maxplayers = get_maxplayers();
}
public plugin_precache()
engfunc( EngFunc_PrecacheSound, newsound );
public fw_emitsound( Ent, Channel, const Sound[], Float:Volume, Float:Attenuation, Flags, Pitch )
{
if( !equali( Sound, oldsound ) )
return FMRES_IGNORED;
static owner, team, i;
owner = pev( Ent, pev_owner );
team = get_user_team( owner );
for( i = 1; i <= g_maxplayers; i++ )
{
if( !is_user_connected( i ) )
continue;
if( get_user_team( i ) != team )
continue;
emit_sound( i, CHAN_ITEM, newsound, Volume, Attenuation, Flags, Pitch );
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
It compiles well but i can`t hear the sound