I think you've all seen this bug when the sound of a door or elevator repeats forever and becomes very annoyng. I've reproduced the bug in the demo.
A client can stop it by writing "stopsound" in console but if a player creates it again you will again hear it
I also found 2 plugins that should fix a similar bug in counter-strike maps like cs_siege. I couldn't test them in hl because I get bad load errror. Maybe they will help you creating a plugin that fixes that bug but without using stopsound.
Here are the plugins
Код:
#include <amxmodx>
#include <amxmisc>
#include <engine>
new enabled, allow
public plugin_init()
{
register_plugin("Fix Echo Sounds","1.0","Throstur")
enabled = register_cvar("amx_soundfix","1")
allow = register_cvar("amx_soundifx_pallow","1")
register_clcmd("say /fixsound","cmdStopsound")
register_srvcmd("soundfix","fRemove")
set_task(0.1,"fRemove")
}
public fRemove()
{
if(get_pcvar_num(enabled) != 1)
return PLUGIN_HANDLED
new Echo = find_ent_by_class(0,"env_sound")
while(Echo)
{
remove_entity(Echo)
Echo = find_ent_by_class(Echo,"env_sound")
}
return PLUGIN_HANDLED
}
public cmdStopsound(id)
{
if(get_pcvar_num(allow) == 1)
{
client_cmd(id,"stopsound;room_type 00")
client_cmd(id,"stopsound")
client_print(id,print_chat,"[AMXX] Your sound will no longer echo now.")
}
else
{
client_print(id,print_chat,"[AMXX] I'm sorry, manual sound fixing is disabled.")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
Код:
#include <amxmodx>
#include <amxmisc>
new enabled, allow
public plugin_init()
{
register_plugin("Mini Sound Fixer" , "1.0" , "Throstur")
register_event("ResetHUD" , "Event_Reset" , "b")
register_clcmd("say /fixsound" , "cmdStopsound")
allow = register_cvar("amx_msoundfix_pallow","1")
enabled = register_cvar("amx_msoundfix","1")
}
public Event_Reset(id)
{
if(get_pcvar_num(enabled) == 1)
{
client_cmd(id,"room_type 00")
}
}
public cmdStopsound(id)
{
if((get_pcvar_num(allow) == 1) || (access(id,ADMIN_IMMUNITY)) )
{
client_cmd(id,"stopsound;room_type 00")
client_cmd(id,"stopsound")
client_print(id,print_chat,"[AMXX] Your sound will no longer echo now.")
}
else
{
client_print(id,print_console,"[AMXX] This command has been disabled.")
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
Link to demo
http://www.girlshare.ro/3182214.2