#include <amxmodx>
#include <fakemeta>
new g_iMaxPlayers;
new g_iPlayersDisable;
new g_iMuted[33];
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()
{
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("say /test", "clcmd_saytest")
register_forward(FM_ClientDisconnect, "fw_ClientDisconnect")
unregister_forward( FM_PrecacheEvent , g_fwid , 1 );
register_forward( FM_PlaybackEvent , "fwPlaybackEvent_Pre" );
register_forward( FM_PlaybackEvent , "fwPlaybackEvent_Post", 1 );
g_iMaxPlayers = get_maxplayers()
}
public clcmd_saytest(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]) g_iPlayersDisable--
g_iMuted[id] = false
}
public fwPlaybackEvent_Pre( 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;
set_pev(invoker, pev_groupinfo, 1)
for (new i = 1; i <= g_iMaxPlayers; i++)
{
if (/*is_user_bot(i) || */i == invoker)
continue;
if (g_iMuted[i]) // is connected and muted
{
set_pev(i, pev_groupinfo, 2) // different groupinfo
}
}
return FMRES_IGNORED;
}
public fwPlaybackEvent_Post( 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;
set_pev(invoker, pev_groupinfo, 0)
for (new i = 1; i <= g_iMaxPlayers; i++)
{
if (/*is_user_bot(i) || */i == invoker)
continue;
if (g_iMuted[i]) // is connected and muted
{
set_pev(i, pev_groupinfo, 0)
}
}
return FMRES_IGNORED;
}