This is a re-write of the original LegacyFuel
script, which can be found here:
https://github.com/InZidiuZ/LegacyFuel
This script utilizes QB-Core
and QB-Banking
to deduct funds from a user's cash account when filling gas or purchasing a jerry can.
- Download the latest version in the "releases" tab on GitHub.
- Drag & drop the folder into your
resources
server folder. - Configure the config file to your liking.
- Add
ensure LegacyFuel-QB
to your server config.
There are currently two (client-sided) exports available, which should help you control the fuel level for vehicles whenever needed.
SetFuel(vehicle --[[ Vehicle ]], value --[[ Number: (0-100) ]])
GetFuel(vehicle --[[ Vehicle ]]) -- Returns the vehicle's fuel level.
Example usage:
function SpawnVehicle(modelHash)
local vehicle = CreateVehicle(modelHash, coords.x, coords.y, coords.z, true, false)
exports["LegacyFuel"]:SetFuel(vehicle, 100)
end
function StoreVehicleInGarage(vehicle)
local plate = GetVehicleNumberPlateText(vehicle)
local fuelLevel = exports["LegacyFuel"]:GetFuel(vehicle)
TriggerServerEvent('vehiclesStored', plate, fuelLevel)
end