Midnight Dev
  • Vehicle Control Menu
    • Installation
    • Configuration
      • Fuel Script
      • Restrictions to Opening Menu
      • Keybinds and Allowed Controls
      • Restricted Passenger Control
      • Refresh Time
      • Hide Headlight/Neon Controls
    • Commands, Exports, Events
  • Neon Controller
    • Installation
    • Configuration
      • Keybinds and Allowed Controls
    • Commands, Exports, Events
  • Midnight Progress Bar
  • Midnight Menu and Input (Package)
Powered by GitBook
On this page
  • No Fuel Srcipt
  • Custom Fuel Script
  1. Vehicle Control Menu
  2. Configuration

Fuel Script

The vehicle control UI displays the amount of fuel a vehicle has. By default, the script will be standalone, using the FiveM native to retrieve the fuel level for the vehicle.

No Fuel Srcipt

If your server does not use any fuel script, simply leave Config.FuelScript as 'none' or 'standalone'.

shared/config.lua
-- The fuel script you wish to use. 
-- The script comes with support for cdn-fuel, legacy-fuel and standalone functionality. Check documentation for more info
Config.FuelScript = 'none'    

Custom Fuel Script

We have configured this script to be compatible with cdn-fuel and legacy-fuel, straight out of the box.

  • If you are using cdn-fuel, change Config.FuelScript to 'cdn-fuel'

  • If you are legacy-fuel, change Config.FuelScript to 'legacy-fuel'

If you are using any other fuel script, you must set Config.FuelScript as 'other' and configure the GetFuelLevel(veh)function in[shared/functions.lua] , and place the code that returns the vehicles fuel amount in the last elseif statement.

shared/functions.lua
function GetFuelLevel(veh)
    --standalone
    if Config.FuelScript == 'none' or Config.FuelScript == 'standalone' then 
        return GetVehicleFuelLevel(veh)

    --cdn fuel script
    elseif Config.FuelScript == 'cdn-fuel' then 
        return exports['cdn-fuel']:GetFuel(veh) 

    --legacy fuel script
    elseif Config.FuelScript == 'legacy-fuel' then
        return DecorGetFloat(veh, '_FUEL_LEVEL') 
    
    elseif Config.FuelScript == 'other' then
        -- If you are using any other fuel script, just add the code that gets the fuel amount right here
        -- Make sure the fuel amount is RETURNED as a number between 0 and 100 
    end
end
PreviousConfigurationNextRestrictions to Opening Menu

Last updated 1 month ago