Voice scripting: proximity, channels, and radio
The setup lesson got voice working as config. This lesson integrates with pma-voice through the API it owns. You will read proximity from a state bag and join radio through setRadioChannel, then study the lower-level Mumble natives for understanding only.
The two ways voice travels
Before any code, hold these two models in your head. They are different systems, and almost every voice bug comes from confusing them.
- Proximity. Your voice is positional. With pma-voice, configured modes and its cycle control own the distance;
LocalPlayer.state.proximityreports the current mode, distance, and name. - Radio. pma-voice layers a push-to-talk radio channel over ordinary proximity. Join with
exports['pma-voice']:setRadioChannel(channel)and leave with channel0. Do not replace pma-voice routing withMumbleSetVoiceChannel.
The mental model to lock in: proximity is a radius, a channel is a room. A radio command does not change anyone's proximity radius. It moves the speaker into a shared room and back out again. Keep those two ideas separate and the natives below stop being a soup of similar names.
Keep reading the full lesson
Sign in to start, then unlock every step of this lesson and the full FiveM School with a membership.
- Build it
- How it works
- Common mistakes
- What you can do now
- Try it yourself
The remainder of Voice scripting: proximity, channels, radio is available to FiveM School members.