Voice channel example
ts
const dispatch = vimp.voice.createChannel('dispatch', {
spatial: false,
})
vimp.on('playerConnected', (player) => {
dispatch?.addPlayer(player, { canSpeak: true, canListen: true })
})
vimp.on('playerDisconnected', (player) => {
dispatch?.removePlayer(player)
})The optional result is checked because channel capacity can be exhausted. A non-spatial channel behaves like radio; proximity audio can remain enabled at the same time.
In a real gamemode, add players only after checking their role and remove them when the role changes, not only on disconnect. Destroy temporary channels when their owning group or session ends.