pma-voice

repository·main·Indexed 42 days ago

https://github.com/avarianknight/pma-voice

A voice system for FiveM and RedM built around the internal Mumble server, providing 3D/2D audio, proximity-based communication, and native audio integration. It includes a client-side and server-side API for managing radio and call channels, volume control, and player muting, as well as a companion voice-ui package version 0.1.0.

Tokens
10.6K
Snippets
45
Records
51
Agent score
54%

What's inside pma-voice

  1. Understanding the `disableRadio` bitwise state

    main

    The disableRadio state bag returns an integer used as a bitwise value. Do not use it as a boolean.

    To check if a radio is disabled for a specific reason, use bitwise operations against these values:

    enum DisabledRadioStates {
    	Enabled = 0,
    	IsDead = 1,
    	IsCuffed = 2,
    	IsPdCuffed = 4,
    	IsUnderWater = 8,
    	DoesntHaveItem = 16,
    	PlayerDisabledRadio = 32,
    }
  2. Use routing buckets with pma-voice

    main
    pma-voice provides native support for routing buckets. This allows you to isolate voice communication within specific routing buckets (often used in FiveM to separate players into different instances or dimensions), ensuring that voice data is only transmitted to players within the same bucket.
  3. Configure pma-voice via ConVars

    main

    All configuration for pma-voice is handled through ConVars. You can set these using the setr command.

    Syntax:

    • For integers (used as booleans where 0 is false and 1 is true): setr [voice_configOption] [int]
    • For strings: setr [voice_configOption] "[string]"

    Important Notes:

    • If a ConVar defaults to 1 (true), you do not need to set it unless you want to disable it.
    • Keybind changes only affect new players. To change keybinds for existing players, they must navigate to Key Bindings -> FiveM -> pma-voice in their game settings.
    • When configuring audio, do not enable both 3d Audio and Native Audio at the same time. It is also recommended to always use voice_useSendingRangeOnly.
    setr voice_enableUi 1
    setr voice_defaultRadioVolume "30"
  4. Grant staff permission to use /muteply

    main

    The /muteply (tgtPly) (duration) command is built into pma-voice. To allow staff members to use it, you must grant them the appropriate Ace permission in your server configuration.

    Example: To allow the group.superadmin group to use the command: add_ace group.superadmin command.muteply allow;

    add_ace group.superadmin command.muteply allow;
  5. Configure Audio modes for FiveM/RedM

    main

    Configure audio behavior using setr commands.

    CRITICAL CONSTRAINTS:

    • Do not enable both voice_use3dAudio and voice_useNativeAudio at the same time. Choose only one audio option.
    • It is highly recommended to always set voice_useSendingRangeOnly to true to prevent unauthorized users from connecting to your mumble server to troll.
    # Example: Enabling native audio and sending range restriction
    setr voice_useNativeAudio true
    setr voice_useSendingRangeOnly true
  6. Migrate to breaking changes in master branch

    main

    If you are upgrading from an older version to the current master branch, note the following breaking changes in configuration keys and state bags:

    • Configuration Keys:

      • Rename voice_defaultPhoneVolume to voice_defaultCallVolume.
      • Rename voice_enablePhones to voice_enableCalls.
    • State Bags:

      • Replace the state bag getter Player(source).state.phone with Player(source).state.call.
  7. Initialize the Voice UI

    main

    Upon loading, the UI automatically sends a POST request to the parent resource to signal that it is ready. This is handled internally by the script via a fetch call to https://${GetParentResourceName()}/uiReady.

    Developers do not need to manually trigger this, but they should ensure the NUI callback uiReady is handled in the client-side Lua code if they need to synchronize state immediately after the UI mounts.