From Onset Developer Wiki

Type: Function
Context: Server
Introduced: v1.1.0


Adds or removes a player from a voice channel. Players in the same channel will hear each other. Channel 0 is the default 3D world channel where players are added automatically on join. Other channels have their sound in 2D.


SetPlayerVoiceChannel(player, channel, enable)


  • player
    The player identifier.
  • channel
    The channel id as an integer. There is no limit on channels.
  • enable
    true to add a player to the voice channel. false to remove them.

Return Value

  • This function returns true on success. If a player is already in a channel it will return false.


function cmd_vc(player, channel)
    -- Remove the player from the world channel. Nearby players will no longer hear him.
    SetPlayerVoiceChannel(player, 0, false)

    -- Add the player to their desired voice channel.
    SetPlayerVoiceChannel(player, channel, true)
AddCommand("vc", cmd_vc)

See also