# Fuel Script (Mandatory)

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.&#x20;

## No Fuel Srcipt

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

{% code title="shared/config.lua" %}

```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'    
```

{% endcode %}

***

## 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.&#x20;

{% code title="shared/functions.lua" %}

```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
```

{% endcode %}
