Guides

Voice

Who hears whom in voice chat — flags per player and overrides per pair, kept per plugin and combined by the core.

ISource2ModVoice decides who hears whom. Each plugin keeps its own flags and overrides, and the core combines them: a mute from one plugin wins over a hear from another. When a plugin unloads, what it set goes with it, and when a player leaves, what was set for them goes too.

plugin.cpp
// Muted for everybody.
g_pSource2ModVoice->SetVoiceFlags(slot, Source2ModVoice_Muted);

// One pair: the warden hears this prisoner, whatever the flags say.
g_pSource2ModVoice->SetListenOverride(warden, prisoner, Source2ModListen::Hear);

What decides

In this order, the first that applies:

  1. The receiver muted the sender themselves on the scoreboard: not heard.
  2. The sender has Source2ModVoice_Muted: not heard.
  3. An override for this receiver and sender: Mute is not heard, Hear is heard.
  4. The sender has Source2ModVoice_All or the receiver Source2ModVoice_ListenAll: heard.
  5. The sender has Source2ModVoice_Team or the receiver Source2ModVoice_ListenTeam: heard within the same team.
  6. What the game decided.

The calls

C++ (g_pSource2ModVoice->)SourcePawn (Source2ModVoice.)
SetVoiceFlags(slot, flags)SetVoiceFlags(slot, flags)This plugin's flags for the player, replacing what it set before.
GetVoiceFlags(slot)GetVoiceFlags(slot)The player's flags from every plugin together.
SetListenOverride(receiver, sender, listen)SetListenOverride(receiver, sender, listen)This plugin's override for the pair; Default takes it back.
GetListenOverride(receiver, sender)GetListenOverride(receiver, sender)The override from every plugin together.
IsSelfMuted(receiver, sender)IsSelfMuted(receiver, sender)Whether the receiver muted the sender themselves.
g_pEngineServer->SetClientProximity(receiver, sender, use)SetClientProximity(receiver, sender, use)Whether the receiver hears the sender only within proximity range. The engine's own setting for the pair, not merged between plugins: the last call wins.

Clients report their own mutes for the first 32 slots only, so a sender above that is never self-muted as far as the server knows.

On this page