Day of Defeat Plugins Community
This site is an archive — everything is readable and downloadable, nothing can be posted. Admin
Archive › Old Forum Threads › General › Requests for DoD Plugins › Serverside Stopsound
22 posts, 5 people · 8,576 views Thread Rating: ★★★★★
closedServerside Stopsound
Started by gunsofnavarone on 12-01-2008, 09:32 PM
G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-01-2008, 09:32 PM #1

OK, here is a common complaint. People use the stopsound frequently so they can hear (primarily) footsteps. So, can a serverside plugin be created to do the same thing?rnrnOne of the issues I have seen for example, is on dod_saints when the planes fly over. Everytime this "event" occurs, even though you've already previously used the stopsound command, you have to do it again. Also, besides hearing footsteps, sometimes it's difficult to hear when people are asking for assistance at some point on the map, etc.rnrnAs, I stated, it's a common complaint on our server, and I was hoping the somehow it could be accomplished serverside and that it would re-check "events" to do it again as necessary.

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-02-2008, 04:48 AM #2

What you can do is adjust the ambience files the map is requesting. Make an empty ambience sound file for the maps your want to make stfu, just replace the ambience sound file with an empty one with exactly the same name.rnrnNobody has to press stopsound anymore as no sound is being played. As for a server sided plugin to enable stopsound, I figure you would need a plugin which stops any sound file from being played.

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-02-2008, 10:23 AM #3

Replacing ambience sound files is an alternative, but I would've thought a plugin would be a much quicker and easier way of handling it. Especially given the number of ambient sound files that exists. And no, we wouldn't want to stop any sound file (as I indicated, people would still want to hear footsteps). I would suspect blocking/stopping any/all sounds would stop those sounds from being played.rnrnI don't know anything (or at least very little) about scripting and for that matter what maps call for which specific ambient files. My server has alone 304 ambient sound files. When I first started my server up back in August, I found the easiest and quickest way to get it up an running (with combination of stock and custom maps) was to upload my local DOD directory. This covered every map I have ever played on or downloaded. Though admittedly, we don't use every map, it leaves us variety to change our map rotation periodically to keep things "fresh". And as I stated before, I don't know which maps call for which ambient sound files. 304 ambient sound files are a lot to edit, and I can only imagine how long that would take. rnrnI may be wrong, but I read somewhere that if somebody wanted to do this, the sound files would have to be the same size as the original. I'm not sure if this is true or not. I suppose if it isn't, I could just make one blank file, and copy/rename it 304 times. But, I'm afraid to take that chance and cause a server crash or something along those lines.

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-02-2008, 10:52 AM #4

I'm sorry dude, after reading my own message it clearly looked like I was in a hurry. I also didn't know if you ran a custom/default map rotation or just a 24/7 onemap server.nnI just finished school so I'll first answer your questions and then I'll look into the option of disabling ambience sound.nnWith the stopping all sounds I meant all sounds from the ambience folder.nn

I may be wrong, but I read somewhere that if somebody wanted to do this, the sound files would have to be the same size as the original.
nnIm not sure about it. You didn't know how the map calls the ambience sound, I've created something for you so you perhaps even learn something from me :D screenshotnnI think before I even start looking at all, which ambience sound do you want to disable? I've seen this in bsp edit: nnI am almost sure if you put that one on 0, it will disable all ambience sounds. BUT..the cap sounds are also part of the map and people will also not hear the capping sounds anymore.nnI think the issue could be the difference between background ambience and the ambience called on events like a mustang flyby, a cap or round win sound file.

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-02-2008, 11:02 AM #5

I've did some searching but can't complete it for you due to lack of knowledge of any map based plugins. Only messed around with players, not maps.rnrnHowever:rnrnThis is for a new round. I assume if you replace the sound/misc/zombie/ambience.mp3" into an empty wav file (im not sure why this plays an mp3 instead of a wav sound).rnrnAgain I don't know if this will overwrite the sound used on your map.rnrn

 #include <amxmodx>rn    rn    new const gs_AmbienSound[] = "sound/misc/zombie/ambience.mp3";rn    rn    public plugin_precache () rn    {rn        precache_generic( gs_AmbienSound );rn    }rn    rn    public plugin_init () rn    {rn        register_plugin ( "Ambience Sound", "0.1",  "DeeKeiD" );rn        register_event ( "HLTV", "e_NewRound", "a", "1=0", "2=0" );rn    }rnrn    public e_NewRound()rn    {rn        client_cmd ( 0, "mp3 play %s", gs_AmbienSound );rn    }
rnrnAnd for new map start:rnrn
#include <amxmodx>rn    rn    new const gs_AmbienSound[] = "sound/misc/zombie/ambience.mp3";rn    rn    public plugin_precache () rn    {rn        precache_generic( gs_AmbienSound );rn    }rn    rn    public plugin_init () rn    {rn        register_plugin ( "Ambience Sound", "0.1",  "DeeKeiD" );rn        register_logevent( "e_RoundStart", 2, "1=Round_Start" );rn    }rnrn    public e_RoundStart()rn    {rn        client_cmd ( 0, "mp3 play %s", gs_AmbienSound );rn    }
rnrnThis might provide some information for someone who actually knows what he/she is talking about (unlike me). If it wasn't any help, my apologies for spamming, if it was, your welcome :DrnrnOh, the source of this information can be found here

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
12-02-2008, 01:00 PM #6

Try this maybe this will work... havent done any testing myself! it should send stopsound to all players when someone respawn.. again didnt test it... please tell if it works or not...rnrn

//////////////////////////////////////////////////////////////////////////////////rn//rn// Information:rn// This plugin will execute "stopsound in the players consol every time someonern// respawnrn//rn//////////////////////////////////////////////////////////////////////////////////rn//rn// Thanks to:rn//rn//////////////////////////////////////////////////////////////////////////////////rn//rn// Changelog:rn//rn//////////////////////////////////////////////////////////////////////////////////rn//rn#include <amxmodx>rn#include <amxmisc>rn#include <dodx>rnrn#define PLUGIN "DoD auto stopsound"rn#define VERSION "v1.0 - by Dr.G"rn#define AUTHOR "Dr.G"rnrnnew const p_stop[] = "stopsound"rnnew p_enablernrnpublic plugin_init() rn{rn	register_plugin(PLUGIN, VERSION, AUTHOR)rn	//Public tracking cvarrn	register_cvar("dod_auto_stopsound_stats", VERSION, FCVAR_SERVER|FCVAR_SPONLY)rn	// Register cvarsrn	p_enable = register_cvar("dod_auto_stopsound","1") // Turns plugin on/off | 1=on 0=offrn}rnpublic dod_client_spawn(id)rnrnif(!is_user_bot(id) && get_pcvar_num(p_enable) && is_user_connected(id))rn	set_task(0.1,"stopsound", id)rnrnpublic stopsound(id)rn	console_cmd(0, p_stop)rn
diamond-optic
posted here
Posts: 2,068
Threads: 103
Joined: May 2005
12-02-2008, 01:28 PM #7

a simple way might be to have a plugin find every ambient_generic entity in the map on map load and change the volume to 0nntho this might disable some sounds you'd want to hear depending on the map (such as round win sounds, spawn gun sounds, radio/mortar sounds, etc etc) ..tho you could probably try to read the spawnflags keyvalue to see which ones are sounds that play all the time or suchnnand you could probably get fancy with it and use a file to list sounds that you want to allow to still play and when its going thru the ambient_generic entities, if the file it uses matches one in the list of allowed sounds it wont set the volume to 0

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-02-2008, 01:28 PM #8

Above stated plugin looks good. Wish I could create something like from the top of my head. Remember though (pointed at gunsofnavarone...love that movie btw) that this only kills ambience loop sounds. So once an airplane flies over you will hear it.rnrnOnly the loop ambience sounds, like the shooting on the background of non-game guns will be killed iwth this plugin.

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
12-02-2008, 05:19 PM #9

I came across this while searching on amxmodxs forum... may help or give a heads up how to solve this http://forums.alliedmods.net/showthread.php?t=45461

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-02-2008, 08:27 PM #10

Well I personally haven't gained any ground on/in this discussion, but it sure has invoked quite a few responses. I tried to download the .sma above, but it won't let me 'til it's approved. I tried to copy the the text within the block above it and compile it but I got a slew of errors (maybe the format or something that I had it in, I don't know).rnrnSo, if you folks don't mind, here's what I'm looking for:rnrnPermit these sounds: Take Flags, Footsteps, Doors, and Win Round.rnrnEverything else can be killed from map generated sounds (not other plugins).rnrnCan it be done? Will somebody do it for me? It seems you guys have a pretty decent idea of how to go about it.

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-02-2008, 08:36 PM #11

BTW, here's the compiled errors:rnrn

Welcome to the AMX Mod X 1.8.1-300 Compiler.rnCopyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Teamrnrn/home/groups/amxmodx/tmp3/php5ctEVX.sma(0) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(2) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(3) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(4) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(5) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(6) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(7) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(8) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(9) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(10) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(11) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(12) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(13) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(14) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(15) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(16) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(17) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(18) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(19) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(20) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(21) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(22) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(23) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(24) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(25) : error 075: input line too long (after substitutions)rn/home/groups/amxmodx/tmp3/php5ctEVX.sma(26) : error 075: input line too long (after substitutions)rnrnCompilation aborted.rn26 Errors.
Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-02-2008, 08:56 PM #12

Here copy paste this code. It was missing { and }'s probably due to php tags changing it around? Anyways, this is tested and compiled successfully.nnI would've given you the sma version but also I can't bypass as im no coder.nnn

//////////////////////////////////////////////////////////////////////////////////nn//nn// Information:nn// This plugin will execute "stopsound in the players consol every time someonenn// respawnnn//nn//////////////////////////////////////////////////////////////////////////////////nn//nn// Thanks to:nn//nn//////////////////////////////////////////////////////////////////////////////////nn//nn// Changelog:nn//nn//////////////////////////////////////////////////////////////////////////////////n//nn#include <amxmodx>n#include <amxmisc>n#include <dodx>nnnn#define PLUGIN "DoD auto stopsound"n#define VERSION "v1.0 - by Dr.G"n#define AUTHOR "Dr.G"nnnnnew const p_stop[] = "stopsound"nnew p_enablennnnpublic plugin_init() n{nn    register_plugin(PLUGIN, VERSION, AUTHOR)n    //Public tracking cvarn    register_cvar("dod_auto_stopsound_stats", VERSION, FCVAR_SERVER|FCVAR_SPONLY)n    // Register cvarsn    p_enable = register_cvar("dod_auto_stopsound","1") // Turns plugin on/off | 1=on 0=offn}nnpublic dod_client_spawn(id)n{nif(!is_user_bot(id) && get_pcvar_num(p_enable) && is_user_connected(id))nn    set_task(0.1,"stopsound", id)n}nnnpublic stopsound(id)n{n    console_cmd(0, p_stop) n}
G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-02-2008, 11:09 PM #13

OK, I was able to download the compiled amxx file. I installed and restarted the server. amx_plugin says it's running. But ambient sounds still play. I even let a bot kill me intentionally to see if it would result after I respawned, but nothing happened. I put debug after the plugin name in the plugin.ini file, and there are no error files or any other mention in the logs.rnrnDo I need to issue a command in console or something?

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-03-2008, 09:53 AM #14

This morning, I added dod_auto_stopsound to the cvar.ini file and added "0" and "1" and "u". I changed maps, the cvar was listed when I brought up the amxmodmenu, but no value was present. I also checked the cmdaccess.ini file and I saw no reference to the plugin in there (I don't know if it should've automatically have been added or not, I know other plugins I have, have indeed been added automatically).rnrnI don't know if all this information is helpful or not, but thought I should share my findings.

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-03-2008, 10:10 AM #15

I've also manually added it to the cmdaccess.ini file, and still nothing happens. I've also rechecked logs this morning (just moments ago) and there are no error logs, or errors reported in the regular logs.

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-03-2008, 01:03 PM #16

The version posted doesn't work, so you prolly didn't do anything wrong. However, I wanted to figure it out myself (see it as a personal victory in learning stuff) and I came up with the following. Tested it on my avalanche server and works perfectly.nnHowever, this will probably won't kill sounds which are being produced once in a while like a mortar hit or an airplane flyby.nnThis is the code, again, I can't bypass waiting time, so just copy paste this into a sma file.nnAs for cvars, I never used cvars.ini, I always use amxx.cfg to place my cvars in. It's already auto-enabled and there is not much need to place the cvar in there. Only if the plugin contained more cvars it's handy to place them in amxx.cfg.nn

//////////////////////////////////////////////////////////////////////////////////nn//nn// Information:nn// This plugin will execute "stopsound in the players consol every time someonenn// respawnnn//nn//////////////////////////////////////////////////////////////////////////////////nn//nn// Thanks to:nn//nn//////////////////////////////////////////////////////////////////////////////////nn//nn// Changelog:nn//nn//////////////////////////////////////////////////////////////////////////////////n//n#include <amxmodx>n#include <amxmisc>n#include <dodx>nn#define PLUGIN "DoD auto stopsound"n#define VERSION "v1.0 - by Dr.G"n#define AUTHOR "Dr.G"nnnew p_enablennpublic plugin_init() n{n    register_plugin(PLUGIN, VERSION, AUTHOR)n    //Public tracking cvarn    register_cvar("dod_auto_stopsound_stats", VERSION, FCVAR_SERVER|FCVAR_SPONLY)n    // Register cvarsn    p_enable = register_cvar("dod_auto_stopsound","1") // Turns plugin on/off | 1=on 0=offn}nnpublic dod_client_spawn(id)n{n	if(!is_user_bot(id) && get_pcvar_num(p_enable) && is_user_connected(id))n	{n		client_cmd(id,"stopsound")n	}n}
nnPs: I personally think since I somewhat helped you I am entitled to somewhat jack your thread for one second.nn
(!is_user_bot(id)
nnWhat does the ! do in front of is_user_bot? I know in combination with != its not equal, but I saw this more then once and don't know what that exclamation mark does.

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
12-03-2008, 03:35 PM #17

Great it works now!rnrn

//This returns falsern(!true)rn//This returns truern(!false)rn
rnrnTaken from http://wiki.amxmodx.org/index.php/Pawn_Tutorial i read that last friday and after/since ive just tryed something, and alot actully started clicking to me... not everything obviously lol, but alot i think. iam still totally green with this, the code i posted took like 15 min to put together, gj tank this is much more straight on then the one i started with... back then i was trying to send it out to all clients by using console_cmd with index 0.. does this send it out to everybody???rnrnthe attached file it the code tank posted above

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-03-2008, 05:10 PM #18

So the ! just stands for NOT, NOT true=fals, NOT false=true? I'm trying to optimise my coding style a bit.rnrnI assume it sends out to everyone as it just detects any client spawning.rnrnI think if you need to do something to everyone, you would need this (I think):rnrn

new max_players[32],inum,irn	get_players(max_players,inum)rn	for(i = 0; i < inum; i++)rn	{your code}rn
rnrnThis is something Synthetic pointed out for my melee on end.rnrnPs: Basic, your knowledge about coding is probably way better then mine. But if we might be on the same level and you need to bounce some ideas back and forth, Im always willing. I am always willing to explain things to other people but also like to learn other stuff from people (although I think in this case I can learn more from you, then you from me).

Dr.G
posted here
Posts: 776
Threads: 75
Joined: Nov 2007
12-03-2008, 06:02 PM #19

http://www.amxmodx.org/funcwiki.php?search=bot&go=searchrnrnu just turn the values around.... (damn i hope i got this right lol)rnrn

rnis_user_bot(id) // if its a bot id would be 1 and we would go ON = count botsrn!is_user_bot(id) // if its a bot id would be set to 0 and we would STOP = ignore bots
rnrnwell the send to all thing is decided by the natives way of handle things I THINK and its not the same with everything.. check out this ie. http://www.amxmodx.org/funcwiki.php?go=func&id=25 and se the noternrn
id is a player index from 1 to 32. 0 will send to all players.
rnrnso i guess it have the player id's figured out it self like if its index is id it will only send to the client involved.. again i may be wrong and it may be why my first code in this thread didnt work lol...rnrnAnd yeah lets help each other out as much as possible.. And lets hope some developers will correct us when we are wrong :D Overall i still got way to many "maybe's" and "may's" when iam trying to code :)

G gunsofnavarone
started this thread
Posts: 159
Threads: 28
Joined: Sep 2008
12-03-2008, 08:22 PM #20

Well, I've tried the new code. It's pretty sweet!! I wish it could kill those "fly-bys". But, if this is the best it's gonna get, it's still a pretty helpful gem. Despite my wanting more out of the plugin, you guys have done a great job and I'm thankful to you.rnrnBy the way, I had added the plugin to the cvar because I saw that it had the on/off capability. So I figured, if it was added to my amxmodmenu listing, if it became necessary, I could easily turn it off from there.

Tank
posted here
Posts: 581
Threads: 59
Joined: Jan 2007
12-03-2008, 08:53 PM #21

Ok, idk, although amxmodxmenu is handy I somehow still type everything by hand in console, always done it that way.rnrnI guess I'll look into that, see what it does for me. Thanks for the tip.rnrnAs far as your request. In all honesty what you are requesting can be done, but I have no idea how to do it as fast and easy and best as possible. My advice is to wait for someone like Synthetic, Diamond-Optic or any of the other developers rnrnIf they don't respond or can't think of something. The only thing I can think off is to sort and add all files from sound/ambience to a plugin, where it says: sound/ambience/ambienceexample = sound/ambience/imanemptywavfile. I dont know if it would work, but I guess thats worth a guess.

H h0_noMan
posted here
Posts: 80
Threads: 11
Joined: Dec 2007
12-04-2008, 01:20 AM #22

You can easily enable/disable the plugin by using the CVARs menu.rnJust add this line to the cvars.ini file (amxmodx/configs/) :rnrn

"dod_auto_stopsound" "0" "1" "u"
Archive › Old Forum Threads › General › Requests for DoD Plugins › Serverside Stopsound
DoD Plugins Archive · Repository · Old Forum Threads · Maps · Admin · built 14 Sep 2026 00:34 UTC