From Garry's Mod
Decides whether a player can hear another player using voice chat.
This hook is called several times a tick, so ensure your code is efficient.
The listening player.
The talking player.
Return true if the listener should hear the talker, false if they shouldn't.
3D sound. If set to true, will fade out the sound the further away listener is from the talker, the voice will also be in stereo, and not mono.
Players can only hear each other if they are within 500 units.
hook.Add("PlayerCanHearPlayersVoice", "Maximum Range", function(listener, talker) if listener:GetPos():Distance(talker:GetPos()) > 500 then return false end end)