Garry's Mod Wiki

GM:PlayerStartVoice

  boolean GM:PlayerStartVoice( Player ply )

Description

Called when a player starts using voice chat.

Set mp_show_voice_icons to 0, if you want disable icons above player.

Arguments

1 Player ply
Player who started using voice chat.

Returns

1 boolean
Set true to hide player's CHudVoiceStatus.

Example

Shows the icon when the player talks.

local icon = Material("icon32/unmuted.png") local function iconfunc() surface.SetDrawColor(255, 255, 255) surface.SetMaterial(icon) surface.DrawTexturedRect(200, 200, 200, 200) end hook.Add("PlayerStartVoice", "ImageOnVoice", function() hook.Add("HUDPaint", "ImageOnVoice", iconfunc) end) hook.Add("PlayerEndVoice", "ImageOnVoice", function() hook.Remove("HUDPaint", "ImageOnVoice") end)