> For the complete documentation index, see [llms.txt](https://docs.jgscripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jgscripts.com/advanced-garages/integrations/custom-fuel-system.md).

# Custom Fuel System

If we don't support your fuel system out of the box, it's super easy to add your own!

1. Go to the `framework` folder, and open `cl-functions.lua`
2. Find the `VehicleGetFuel` and `VehicleSetFuel` functions, which should look like this:

```lua
function Framework.Client.VehicleGetFuel(vehicle)
  if (Config.FuelSystem == "LegacyFuel" or Config.FuelSystem == "ps-fuel" or Config.FuelSystem == "lj-fuel" or Config.FuelSystem == "cdn-fuel" or Config.FuelSystem == "hyon_gas_station") then
    return exports[Config.FuelSystem]:GetFuel(vehicle)
  elseif Config.FuelSystem == "ox_fuel" then
    return GetVehicleFuelLevel(vehicle)
  else
    return 65 -- or set up custom fuel system here...
  end
end

function Framework.Client.VehicleSetFuel(vehicle, fuel)
  if (Config.FuelSystem == "LegacyFuel" or Config.FuelSystem == "ps-fuel" or Config.FuelSystem == "lj-fuel" or Config.FuelSystem == "cdn-fuel" or Config.FuelSystem == "hyon_gas_station") then
    exports[Config.FuelSystem]:SetFuel(vehicle, fuel)
  elseif Config.FuelSystem == "ox_fuel" then
    Entity(vehicle).state.fuel = fuel
  else
    -- Setup custom fuel system here
  end
end
```

3. Inside the `VehicleGetFuel` function, within the `else` block where it says\
   \
   `return 65 -- or set up custom fuel system here...`\
   \
   replacing it with your custom **get fuel level** code. Remember to rename the vehicle entity variable to `vehicle` in case your code snippet has it named differently.<br>
4. Do the same inside the `VehicleSetFuel` function replacing the line that says\
   \
   `-- Setup custom fuel system here`\
   \
   with the **set fuel level** function of your fuel script. The vehicle entity variable is named `vehicle` and the fuel level is named `fuel` - again make sure to rename these if they are named differently in the snippet you are using! <br>
5. Make sure that in the Configurator or `config.lua` you have set the Fuel system to **None**.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.jgscripts.com/advanced-garages/integrations/custom-fuel-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
