Hiding the Voice Chat Panel

I’ve done a little Googling, however I couldn’t really seem to find the answer anywhere. What is the best way to prevent the default voice chat box on the right side of the screen from appearing?

Use a

GM:HUDShouldDraw hook and stop CHudVoiceSelfStatus and CHudVoiceStatus.

Sadly, it did not work.



function hidehud(name)
	local tab = {
		"CHudHealth",
		"CHudBattery",
		"CHudCrosshair",
		"CHudAmmo",
		"CHudSecondaryAmmo",
		"CHudVoiceSelfStatus",
		"CHudVoiceStatus"
	}
	
	for k, v in pairs(tab) do
		if name == v then return false; end
	end

	if name == "CHudDamageIndicator" and !LocalPlayer():Alive() then
		return false
	end
end
hook.Add("HUDShouldDraw", "HideOldie", hidehud)


First off, you should create that table OUT of the hook. Then, it’d be better if you’d do something like this:



local tab = {
	["CHudVoiceSelfStatus"] = false,
	["CHudVoiceStatus"] = false
}

hook.Add("HUDShouldDraw", "HideOldie", function(name)
	return tab[name]
end)