Gamemode.PlayerCanHearPlayersVoice

From GMod Wiki

Jump to: navigation, search
Up one category:
Lua
Go to:
Gamemode Hooks


Event Hook
Hook NamePlayerCanHearPlayersVoice
SyntaxGM:PlayerCanHearPlayersVoice( Player pListener, Player pTalker )
DescriptionUsed to determine if one player can hear another's voice.
ReturnsBoolean
Lua State
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerCanHearPlayersVoice]Gamemode.PlayerCanHearPlayersVoice [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Example

DescriptionPlayers cannot hear admins talking
Used on
Code
function GM:PlayerCanHearPlayersVoice( plOne, plTwo )
	return ((plOne:IsAdmin() or !plTwo:IsAdmin()) or (plOne == plTwo))
end
OutputAdmins cannot be heard by other players.


Additional Notes

  • Seems to be called every 7 ticks
  • While bots are called for the second argument, they're never called as the first.
  • The first player object and the second player object may be the same player, however returning true doesn't seem to emulate voice_loopback 1
  • The function will be overridden if sv_alltalk is set to 1.
Personal tools