sg-fuel

Free

A modern fuel system for FiveM combining the best of qb-fuel and LegacyFuel, featuring an enhanced NUI, player-owned gas stations, and flexible fuel consumption options.

Overview

SG-Fuel is an advanced fuel management script that provides seamless compatibility with both qb-fuel and LegacyFuel. Choose between traditional qb-fuel consumption mechanics or the more realistic RPM-based consumption system from LegacyFuel, all while enjoying a sleek, modern user interface.

Features

Core Features

  • Dual Consumption Systems
  • Enhanced Modern NUI
  • Full Export Compatibility
  • Player-Owned Gas Stations

Fuel Management

  • Jerry Cans
  • Emergency Refuel
  • Custom Fuel Pricing
  • Fuel Ordering

Exports

SG-Fuel provides the same exports as both LegacyFuel and qb-fuel:

-- Get vehicle fuel level (0-100)
local fuel = exports['sg-fuel']:GetFuel(vehicle)
-- or for LegacyFuel compatibility
local fuel = exports['LegacyFuel']:GetFuel(vehicle)
-- or for qb-fuel compatibility
local fuel = exports['qb-fuel']:GetFuel(vehicle)

-- Set vehicle fuel level (0-100)
exports['sg-fuel']:SetFuel(vehicle, amount)
-- or for LegacyFuel compatibility
exports['LegacyFuel']:SetFuel(vehicle, amount)
-- or for qb-fuel compatibility
exports['qb-fuel']:SetFuel(vehicle, amount)

Dependencies

Required

  • qb-core - QBCore Framework
  • oxmysql - MySQL wrapper

Optional

  • qb-target or ox_target
  • ox_lib (for notifications)

Installation

1

Download & Place

Download the resource and place it in your resources folder

2

Rename Folder

Rename the folder to sg-fuel (important for compatibility)

3

Import Database Tables

Import the database tables from install/jobs.lua if needed

4

Choose Optional Dependencies

Install if desired:

  • - ox_lib - If you want to use ox_lib notifications
  • - qb-target or ox_target - If you want to use target interaction instead of 3D text
5

Configure

Configure the script in config.lua to your preferences:

  • - Set Config.NotificationProvider to 'qb' or 'ox_lib'
  • - Set Config.VehicleInteractionMethod to 'target' or '3dtext'
6

Add to server.cfg

ensure sg-fuel

Configuration

Provider Auto-Detection

SG-Fuel automatically detects your installed resources:

  • - Target System: Automatically detects and uses either qb-target or ox_target
  • - Notifications: Configure to use either qb-core or ox_lib notifications

No additional setup required - just install your preferred resources and configure in config.lua!

Fuel Consumption Modes

Choose your preferred fuel consumption system:

-- Use RPM-based consumption (LegacyFuel style)
Config.UseLegacyFuelConsumption = true

-- Or use qb-fuel style consumption
Config.UseLegacyFuelConsumption = false

Key Configuration Options

Config.FuelPrice = 50                          -- Price per liter
Config.Currency = 'R'                          -- Currency symbol
Config.SyncFuelBetweenPlayers = true           -- Enable fuel sync
Config.ShowNearestGasStationOnly = true        -- Smart blip system

Notification Provider

Choose between QBCore or ox_lib notifications:

Config.NotificationProvider = 'qb'             -- Options: 'qb' or 'ox_lib'
Config.NotificationPosition = 'left-center'    -- Notification position on screen

Position Options: 'left-center', 'right-center', 'top-center', 'bottom-center', 'top-left', 'top-right', 'bottom-left', 'bottom-right'

Note: Position names are automatically mapped between qb-core and ox_lib formats. Just use the qb-core format names, and they will work with both notification systems!

Interaction Method

Choose your preferred interaction system:

Config.VehicleInteractionMethod = '3dtext'     -- Options: 'target' or '3dtext'
-- If using 'target', the script automatically detects qb-target or ox_target

Note: The script automatically detects which target resource you have installed (qb-target or ox_target). No additional configuration needed!

Emergency Refuel

Configure the emergency refuel system for gas station employees:

Config.EmergencyRefuel = {
    Enabled = true,
    RequireEmployeeJob = true,
    MaxDistance = 5.0,
    Command = 'emergencyrefuel',
}

Player-Owned Stations

Set up business ownership for each gas station:

Config.GasStations = {
    [vector3(49.4187, 2778.793, 58.043)] = 'express1',
    [vector3(263.894, 2606.463, 44.983)] = 'express1',
    -- Add more stations...
}

Commands

  • /emergencyrefuel - Gas station employees can refuel nearby vehicles
  • /emergencyrefuelhelp - Display emergency refuel help

Important Notes

  • DO NOT RESTART the script while the server is running - it will break compatibility with other resources. Players will need to reconnect.
  • DO NOT RENAME the resource folder from sg-fuel - this will break functionality
  • If you encounter issues after breaking these rules, restart the entire server

Compatibility

This script is designed to work seamlessly with:

Export Compatibility

  • - Resources calling LegacyFuel exports
  • - Resources calling qb-fuel exports

Framework & Integrations

  • - QBCore framework (required)
  • - qb-target or ox_target (optional - required only if using 'target' interaction method)
  • - ox_lib (optional - required only if using 'ox_lib' as notification provider)
  • - sg-loadshedding (optional - for power outage integration)

Credits

  • - Original Base: qb-fuel
  • - Enhanced By: sgMAGLERA
  • - Combines Features From: LegacyFuel & qb-fuel

Support

For support, please ensure you:

  1. Have not renamed the resource
  2. Have not restarted the script mid-session
  3. Have correctly configured the config.lua
  4. Have all required dependencies