Skip to content

A simple, lightweight fuel script for FiveM

License

Notifications You must be signed in to change notification settings

MewizardVT/LegacyFuel

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This is a forked version of LegacyFuel after the original developer(s) abandoned the project; I am just now learning .lua so please bear with me.

Installation

  1. Download the latest release on GitHub.
  2. Drag & drop the folder into your resources server folder.
  3. Configure the config file to your liking.
  4. Add start LegacyFuel to your server config.

NOTE:

I will not be implementing the ESX Economy features of this script, however; if someone would like to make a PR with those features, I would be happy to take a look and implement if I see fit.

Exports

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

About

A simple, lightweight fuel script for FiveM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Lua 100.0%