Revision Difference
GM:PlayerStartVoice#568280
<function name="PlayerStartVoice" parent="GM" type="hook">
<description>Called when a player starts using voice chat.
See <page>GM:PlayerEndVoice</page> for the hook when the player stops talking.
<note>Set `mp_show_voice_icons` to 0, if you want disable voice chat icons above player heads.</note>
</description>
<realm>Client</realm>
<args>
<arg name="ply" type="Player">Player who started using voice chat. Can be NULL when player entity is outside of the PVS. Use the player index.</arg>
<arg name="plyIndex" type="number" default="nil">The player index. Only appears when non-local player speaks for the first time.
<arg name="plyIndex" type="number" default="nil">The <page text="player index">Entity:EntIndex</page>. Only appears when non-local player speaks for the first time.
After August 2026 - always provided.
</arg>
</args>
</function>
<example>
<description>Shows the icon when the player talks.</description>
<code>
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)
</code>
</example>
Garry's Mod
Rust
Steamworks
Wiki Help