Garry's Mod Wiki

GM:PlayerStartVoice

  GM:PlayerStartVoice( Player ply, number plyIndex = nil )

Description

Called when a player starts using voice chat.

See GM:PlayerEndVoice for the hook when the player stops talking.

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

Arguments

1 Player ply
Player who started using voice chat. Can be NULL when player entity is outside of the PVS. Use the player index.
2 number plyIndex = nil
The player index. Only appears when non-local player speaks for the first time.

After August 2026 - always provided.

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)