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.
// 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);// Muted for everybody.
Source2ModVoice.SetVoiceFlags(slot, Source2ModVoice_Muted);
// One pair: the warden hears this prisoner, whatever the flags say.
Source2ModVoice.SetListenOverride(warden, prisoner, Source2ModListen_Hear);What decides
In this order, the first that applies:
- The receiver muted the sender themselves on the scoreboard: not heard.
- The sender has
Source2ModVoice_Muted: not heard. - An override for this receiver and sender:
Muteis not heard,Hearis heard. - The sender has
Source2ModVoice_Allor the receiverSource2ModVoice_ListenAll: heard. - The sender has
Source2ModVoice_Teamor the receiverSource2ModVoice_ListenTeam: heard within the same team. - 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.