rytrak.fr Documentation
  • 🛡️FiveM Assets Escrow
    • You lack the required entitlement
    • Failed to verify protected resource
    • Error parsing script / Failed to load script
  • ❓Store FAQ
    • Do you accept orders to create a custom script
    • Do you give decrypted scripts
    • What payment methods are accepted for the purchase of your scripts?
    • Do you offer discounts or special offers on your scripts?
    • Can I modify or customize your scripts to meet my needs
    • Are your scripts compatible with frameworks
    • Do you provide development assistance?
  • FiveM Scripts
    • 🚒Firefighter SCBA System
      • General Configuration
      • Adapt your EUP
      • General Exports
      • General Events
      • ❓FAQ
        • No such export IsFireNearby in resource SmartFires
      • Test it now
    • 👮‍♂️Advanced Police Grab Ped
      • General Configuration
      • General Exports
      • General Events
      • Compatibility with esx_policejob
      • Test it now
    • 🚿Advanced Pepper Spray
      • General Configuration
      • General Exports
      • Anticheat
      • Test it now
    • 📣Advanced Megaphone System
      • General Configuration
      • General Exports
      • Compatibility with pma-voice
      • Compatibility with mumble-voip
      • Compatibility with saltychat
      • ❓FAQ
        • I can't hear my voice through the megaphone
      • Test it now
    • 🚁Advanced Helicopter Bucket
      • General Configuration
      • Adapt our script with ToxicFire
      • General Exports
      • 🔐Test it now
    • 🔗Advanced Remote Restraint
      • General Configuration
      • General Exports
      • Test it now
    • 🚗Advanced Extrication System
      • General Configuration
      • General Exports
      • Adapt a vehicle to the roof system
      • List of vehicles compatible with the roof system
      • 🔐Test it now
    • 🔗Advanced Handcuffs System
      • General Configuration
      • General Exports
      • Make ESX compatible
      • Make QBCore compatible
      • Make OX-Inventory compatible
      • 🔐Test it now
    • ✈️Advanced Aerial Firefighting
      • General Configuration
      • Adapt our script with ToxicFire
      • General Exports
      • 🔐Test it now
    • 💣Advanced Tactical Gas System
      • General Configuration
      • Test it now
  • RedM Scripts
    • 🤠Advanced Sheriff Grab Ped
      • General Configuration
      • General Exports
  • Framework compatibility
    • Add a custom weapon on ESX
    • Add a custom weapon on QBCore
    • Add a custom weapon on OX Inventory
  • 🚀Test our resources for free with Zap-Hosting
Powered by GitBook
On this page
  • 1. Installation & Basic Setup
  • 2. Common Errors & Solutions
  1. FiveM Scripts
  2. Advanced Megaphone System

Compatibility with pma-voice

PreviousGeneral ExportsNextCompatibility with mumble-voip

Last updated 1 month ago

This guide explains how to make the Advanced Megaphone System compatible with PMA-Voice.


1. Installation & Basic Setup

  1. Install PMA-Voice and the LATEST version of r_megaphone on your server.

  2. Enable PMA-Voice compatibility in the config.lua file of r_megaphone:

    • Open the config.lua file of r_megaphone.

    • Modify the following settings:

      Config.Compatibility.PMAVoice.enabled = true
      Config.Compatibility.PMAVoice.resourceName = 'pma-voice'
  3. Manually create the megaphone.lua file in pma-voice:

    • Navigate to the folder:

      ../pma-voice/client/
    • Create a new file named megaphone.lua.

  4. Add the following code to megaphone.lua:

You can change the distance of the megaphone's range using the first line.

table.insert(Cfg.voiceModes, {35.0, 'Megaphone'})

exports('setMegaphone', function(previousVoiceRange)
    if not previousVoiceRange then
        mode = #Cfg.voiceModes
        setProximityState(Cfg.voiceModes[#Cfg.voiceModes][1], true)
    else
        mode = previousVoiceRange
        setProximityState(Cfg.voiceModes[previousVoiceRange][1], false)
    end
end)

exports('getMegaphone', function()
    return mode
end)

RegisterCommand('cycleproximity', function()
    if GetConvarInt('voice_enableProximityCycle', 1) ~= 1 or disableProximityCycle then return end
    
    local newMode = mode + 1
    if newMode <= #Cfg.voiceModes and newMode ~= #Cfg.voiceModes - 1 then
    	mode = newMode
    else
    	mode = 1
    end
    
    setProximityState(Cfg.voiceModes[mode][1], false)
    TriggerEvent('pma-voice:setTalkingMode', mode)
end, false)

if gameVersion == 'fivem' then
    RegisterKeyMapping('cycleproximity', 'Cycle Proximity', 'keyboard', GetConvar('voice_defaultCycle', 'F11'))
end
  1. Modify fxmanifest.lua in pma-voice:

    • Open the fxmanifest.lua file of pma-voice.

    • Add the following line at the end of the file:

      client_script 'client/megaphone.lua'
  2. Ensure the correct startup order in server.cfg: Make sure pma-voice is started before r_megaphone in your server.cfg:

    ensure pma-voice  
    ensure r_megaphone
  3. Restart your server to apply the changes.


2. Common Errors & Solutions

Why does this issue occur? This error typically appears when r_megaphone is started for the first time without restarting the server. The script tries to auto-generate a file named megaphone.lua inside the pma-voice script. However, it might fail due to:

2.1 Error: r_megaphone must contain the following line in your server.cfg file to work

Cause: The r_megaphone script needs this line to produce the appropriate voice effects.

Solution: Check that this line appears in the server.cfg. If not, add it.

setr voice_enableSubmix 1

2.2 Error: r_megaphone must be started after pma-voice in the server.cfg file!

Cause: r_megaphone depends on pma-voice and must load afterward to access its functions.

Solution: Adjust your server.cfg:

ensure pma-voice  
ensure r_megaphone
📣