HUD Element Voice Icon Can't Be Hid?

I noticed in the gmod wiki that CHudVoiceStatus and CHudVoiceSelfStatus have stars next to them and have no page. Is there an alternative method to hiding the voice speaker over a players head?

I think they might be in the game now. Use them with HUDShouldDraw

This is my code im using
[lua]
function hidehud(name)
for k, v in pairs{“CHudHealth”, “CHudBattery”, “CHudAmmo”, “CHudSecondaryAmmo”, “CHudVoiceStatus”} do
if name == v then return false end
end
end
hook.Add(“HUDShouldDraw”, “hidehud”, hidehud)
[/lua]

Perhaps because Garry changed over to a new system?

Can you do that “pairs{”

It works for all the rest of the hide huds

Try this (clientside):
[lua]
g_VoicePanelList:SetVisible(false)
[/lua]

try this:
[lua]
function hidehud(name)
if(name == “CHudHealth” or name == “CHudBattery” or name == “CHudAmmo” or name == “CHudSecondaryAmmo” or name == “CHudVoiceStatus”)
return false
end
end
hook.Add(“HUDShouldDraw”, “hidehud”, hidehud)
[/lua]

EDIT:

Didn’t see him say the pairs{ worked. :expressionless:

@maurits150
That works but I am not trying to hide the display tabs on the right of the screen I am trying to hide the yellow speaker icon above the players head.

Isn’t that included in source?

Since garry converted the voice tabs on the right to lua I was hoping the hide hud would only hide the icon above the players head and keep the tabs of the right.

You could do something hacky…

Make the material for the icon above players heads (“materials/voice/icntlk_sv” I think) invisible with lua. Then make your own icons that you can control using the hooks PlayerStartVoice and PlayerEndVoice.

Yea I was looking in those files earlier didnt know if it would effect clientside, I already have the new icons made just need to iron out some bugs.

There’s icntlk_local, icntlk_sv, and icntlk_pl.

You’ll need an invisible texture ( you can get one I whipped together for you here ) because I didn’t know if there was a working one or not ( unsure of nodraw not drawing, plus it’s unlit generic ).

To use, I think this is what you’d need to do.

First, send those two files to the clients, and a clientside file or in your gamemode’s client files if that’s what you are doing.



local function Initialize( )
	local mat, mat2, mat3, mat4, bt
	
	mat = Material( "invisible" )
	bt = mat:GetMaterialTexture( "$basetexture" )
	
	mat2 = Material( "voice/icntlk_local" 	)
	mat3 = Material( "voice/icntlk_sv" 	)
	mat4 = Material( "voice/icntlk_pl" 	)
	
	mat2:SetMaterialTexture( "$basetexture", bt )
	mat3:SetMaterialTexture( "$basetexture", bt )
	mat4:SetMaterialTexture( "$basetexture", bt )
end

hook.Add( "Initialize", "Hide talk indicators", Initialize )


Something like that would do the trick, I suppose.

Although it’s the worst way I can think of doing it, given that implementation of blocking the element would be a much better solution.

A few questions, first I seem to get material is nil when I load srcds.

Second I am alittle confused about where I put the function, from what I am reading I put it in a client file and then ship it off to the clients?

That’s a clientside file, you don’t run it on the server. It needs to be sent to the client.

Oh, that’s what you needed to do. You were being a little unclear.

I have the texture files in my addon under materials/voice/ and the file which I named cl_hidevoice.lua in lua/autorun/client/ and it downloads fine along with the textures but the voice icon above the players head is purple and black squares.

Those two texture files go in the root of the materials folder.

You can alternately edit the vmt to have the basetexture property of “voice/invisible” rather than “invisible”.

I think I am having a tard moment, I can’t seem to get this working, first it went to purple and black and now it is a black square. Sorry if I am being an anoyyance im pretty out of it tonight.