Garry's Mod Wiki

Revision Difference

GM:PlayerStartVoice#528423

<function name="PlayerStartVoice" parent="GM" type="hook"> <ishook>yes</ishook> <description>Called when a player starts using voice chat.</description> <realm>Client</realm> <args> <arg name="ply" type="Player">Player who started using voice chat</arg> </args> </function> <example> <description>Show Image when the player talk</description>⤶ <description>Show an image when a Player talks</description> <code> local icon = Material("icon32/unmuted.png") hook.Add("PlayerStartVoice", "ImageOnVoice", function() hook.Add("HUDPaint", "ImageOnVoice", function() surface.SetDrawColor(255, 255, 255) surface.SetMaterial(icon) surface.DrawTexturedRect(200, 200, 200, 200) end) end) hook.Add("PlayerEndVoice", "ImageOnVoice", function() hook.Remove("HUDPaint", "ImageOnVoice") end) </code> </example>