Resolving the Issue: Error: Your server must be restarted to support pma-voice

Why does this issue occur?

This error typically occurs when starting the r_megaphone script for the first time without restarting the server. During the initial start, the required megaphone.lua file is automatically generated in the pma-voice script folder. However, the error might persist due to the following reasons:

  • The r_megaphone script does not have the necessary permissions to create the file.

  • Another issue related to file permissions or script configuration.

Steps to Fix This Issue

If the error persists, follow these steps to manually resolve it:

  1. Manually Create the megaphone.lua File

    • Navigate to the following folder: @pma-voice/client/.

    • Create a file named megaphone.lua.

    • Copy and paste the following code into the file:

      table.insert(Cfg.voiceModes, {35.0, 'Megaphone'}) -- Here you can change the distance of megaphone
      
      exports('setMegaphone', function(bool, value)
          if bool then
              mode = #Cfg.voiceModes
              setProximityState(Cfg.voiceModes[#Cfg.voiceModes][1], true)
              TriggerEvent('pma-voice:setTalkingMode', #Cfg.voiceModes)
          else
              mode = value
              setProximityState(Cfg.voiceModes[value][1], false)
              TriggerEvent('pma-voice:setTalkingMode', value)
          end
      end)
      
      exports('getMegaphone', function()
          return mode
      end)
      
      RegisterCommand('cycleproximity', function()
          -- Proximity is either disabled, or manually overwritten.
          if GetConvarInt('voice_enableProximityCycle', 1) ~= 1 or disableProximityCycle then return end
          local newMode = mode + 1
      
          -- If we're within the range of our voice modes, allow the increase, otherwise reset to the first state
          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
  2. Modify the fxmanifest.lua File in pma-voice

    • Open the fxmanifest.lua file in the pma-voice script.

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

      client_script 'client/megaphone.lua'
  3. Ensure the Startup Order in server.cfg

    • Make sure that the r_megaphone script is started after pma-voice in the server.cfg file. Example:

      ensure pma-voice  
      ensure r_megaphone  
  4. Restart the Server

    • Restart the server to apply the changes.

Last updated