Raised This Month: $32 Target: $400
 8% 

Can Server change the sound volume?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 12-10-2017 , 16:29   Can Server change the sound volume?
Reply With Quote #1

Is it possible for the server to briefly adjust the sound volume for clients? If so, what commands would I use?

Issue: On my TF2 server one of the cfg files I have causes the Shred Alert taunt to take place. The volume is incredibly loud and players complain of 'ear rape'. I'd like to know if there is a command I can run before the taunt to reduce the volume, and another command I can run after the taunt to restore the original volume.
PC Gamer is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 12-11-2017 , 08:07   Re: Can Server change the sound volume?
Reply With Quote #2

You'd probably be better off lowering the volume of the Shred Alert taunt with a plugin like so:

Code:
#pragma semicolon 1
#include <sourcemod>

#include <sdktools_sound>

#pragma newdecls required

ConVar g_ShredAlertVolume;

public void OnPluginStart() {
	g_ShredAlertVolume = CreateConVar("sm_shred_alert_volume", "0.1",
			"Sets the volume of the Shred Alert taunt.");
	AddNormalSoundHook(OnShredAlertPlayed);
}

public Action OnShredAlertPlayed(int clients[MAXPLAYERS], int &numClients,
		char sample[PLATFORM_MAX_PATH], int &entity, int &channel, float &volume, int &level,
		int &pitch, int &flags, char soundEntry[PLATFORM_MAX_PATH], int &seed) {
	if (StrContains(sample, "brutal_legend_taunt.wav") != -1) {
		volume = g_ShredAlertVolume.FloatValue;
		return Plugin_Changed;
	}
	return Plugin_Continue;
}
Edit: Added a ConVar so you can change the volume before your command, if you want Shred Alert taunts played at other times to be at full volume.
Attached Files
File Type: sp Get Plugin or Get Source (quiet_shred_alert.sp - 270 views - 734 Bytes)
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 12-11-2017 at 08:20.
nosoop is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 12-13-2017 , 15:39   Re: Can Server change the sound volume?
Reply With Quote #3

nosoop, Plugin works great! Thanks!
PC Gamer is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode