Custom Voice Icon

Hello everybody. I come to facepunch again in need of help. I am trying to get a custom voice icon. I have the positioning and everything set up. I just can’t make it come up when a player talks. I made it so it comes up when a player presses x, but what if someone binded their push to talk key to another key?

Here is the voice icon part of my code


local MicIcon = Material("materials/walkietalkieicon.png")


	if ( input.IsKeyDown( KEY_X ) ) then
		surface.SetMaterial( MicIcon )
		surface.SetDrawColor( 255, 255, 255, 255 )
		surface.DrawTexturedRect(ScrW() / 14, ScrH() / 80,162,162)
	end

Any ideas?

Cheers,
Nikorev

Try out :IsSpeaking()

[lua]
if ( LocalPlayer():IsSpeaking() ) then
surface.SetMaterial( MicIcon )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.DrawTexturedRect(ScrW() / 14, ScrH() / 80,162,162)
end
[/lua]

I will try it out tomorrow. I don’t have access tonight. Thanks for the help.

Works like I charm. I never knew there was an IsSpeaking(). I was searching for something like this for a while. Cheers!