Garry's Mod Wiki

Revision Difference

GM:PlayerStartVoice#527315

<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>⤶ <code>⤶ hook.Add("PlayerStartVoice", "CallWhenVoice", function()⤶ hook.Add("HUDPaint", "HiChuck", function()⤶ surface.SetDrawColor(255, 255, 255, 255)⤶ surface.SetMaterial(Material("hlmv/background"))⤶ surface.DrawTexturedRect(200, 200, 200, 200)⤶ end)⤶ end)⤶ ⤶ hook.Add("PlayerEndVoice", "Stopvoice", function()⤶ hook.Remove("HUDPaint", "HiChuck")⤶ end)⤶ </code>⤶ <upload src="8e3f9/8d8130b19619b8c.png" size="198584" name="image.png" />⤶ <output><image src="8e3f9/8d8130b19619b8c.png"/></output>⤶ </example>