#include <amxmodx>
#include <fakemeta>
#include <reapi>
new g_iMaxPlayers;
new g_iPlayersDisable;
new g_iMuted[33];
new const FireSound[] = "weapons/glock18-1.wav";
new const g_guns_events[][] =
{
"events/awp.sc",
"events/g3sg1.sc",
"events/ak47.sc",
"events/scout.sc",
"events/m249.sc",
"events/m4a1.sc",
"events/sg552.sc",
"events/aug.sc",
"events/sg550.sc",
"events/m3.sc",
"events/xm1014.sc",
"events/usp.sc",
"events/mac10.sc",
"events/ump45.sc",
"events/fiveseven.sc",
"events/p90.sc",
"events/deagle.sc",
"events/p228.sc",
"events/glock18.sc",
"events/mp5n.sc",
"events/tmp.sc",
"events/elite_left.sc",
"events/elite_right.sc",
"events/galil.sc",
"events/famas.sc"
};
new g_guns_eventids_bitsum , g_fwid;
public plugin_precache()
{
precache_sound( FireSound );
g_fwid = register_forward( FM_PrecacheEvent , "fwPrecacheEvent" , 1 );
}
public fwPrecacheEvent( type , const name[] )
{
for (new i = 0; i < sizeof g_guns_events; ++i)
{
if ( equal( g_guns_events[ i ] , name ) )
{
g_guns_eventids_bitsum |= ( 1 << get_orig_retval() );
return FMRES_HANDLED;
}
}
return FMRES_IGNORED;
}
public plugin_init() {
register_plugin("Player Disable Fire Sound", "0.1", "RauliTop")
register_clcmd("radio3", "clcmd_radio3")
register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")
unregister_forward( FM_PrecacheEvent , g_fwid , 1 );
register_forward( FM_PlaybackEvent , "fwPlaybackEvent" );
g_iMaxPlayers = get_maxplayers()
}
public clcmd_radio3(id)
{
g_iMuted[id] = !(g_iMuted[id])
if (g_iMuted[id])
{
g_iPlayersDisable++
client_print(id, print_center, "Fire Weapon Sound: OFF")
}
else
{
g_iPlayersDisable--
client_print(id, print_center, "Fire Weapon Sound: ON")
}
return PLUGIN_HANDLED;
}
public fw_ClientDisconnect(id)
{
if (!g_iMuted[id]) return;
g_iMuted[id] = false
g_iPlayersDisable--
}
public fwPlaybackEvent( flags, invoker, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2, bparam1, bparam2 )
{
if ( !( g_guns_eventids_bitsum & ( 1 << eventid ) ) || !( 1 <= invoker <= g_iMaxPlayers ) )
return FMRES_IGNORED;
if (!g_iPlayersDisable)
return FMRES_IGNORED;
for (new i = 1; i <= g_iMaxPlayers; i++)
{
if (!is_user_connected(i) || i == invoker)
continue;
if (!g_iMuted[i])
{
//emit_sound( invoker , CHAN_WEAPON , FireSound , VOL_NORM , ATTN_NORM , 0 , PITCH_NORM );
rh_emit_sound2( invoker , i , CHAN_WEAPON , FireSound , VOL_NORM , ATTN_NORM , flags , PITCH_NORM );
}
}
return FMRES_SUPERCEDE; // mute fire sound you hear from others
}