Commands & Exports

This section lists all available commands, exports, and events included in the script. You’ll find client-side, server-side, and shared functions designed to help developers integrate, extend, or interact with the system easily within their own scripts or frameworks.


Client Exports

This section provides all available client exports for the script. These functions allow you to interact directly with the system from the client side, enabling custom features, UI interactions, and integrations with other resources. Each export includes a short description and usage example for easy implementation.

SetFuel

The SetFuel export allows you to set the fuel level of a specific vehicle programmatically. This is useful for customizing fuel levels during gameplay scenarios such as refueling, debugging, or initializing vehicles with specific fuel values.


How to Use

To set the fuel level of a vehicle, use the following code:

-- Set the fuel level for a specific vehicle
exports['qs-fuelstations']:SetFuel(vehicle, fuelLevel)

Example:

local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) -- Get the current vehicle
local fuelLevel = 50 -- Set the fuel level to 50%
exports['qs-fuelstations']:SetFuel(vehicle, fuelLevel)
print("Fuel level set to: " .. fuelLevel)

This export takes two parameters:

  • vehicle: The entity ID of the vehicle whose fuel level is to be set.

  • fuelLevel: The desired fuel percentage (e.g., 50 for 50%).

This function ensures that fuel levels can be adjusted seamlessly, enhancing gameplay customization and debugging options.

GetFuel

The GetFuel export allows you to retrieve the current fuel level of a specified vehicle. This is useful for monitoring fuel levels, implementing fuel consumption mechanics, or integrating fuel data into custom scripts.


How to Use

To obtain the fuel level of a vehicle, use the following code:

local fuelLevel = exports['qs-fuelstations']:GetFuel(vehicle)
print("Current fuel level: " .. fuelLevel)

Example:

local vehicle = GetVehiclePedIsIn(PlayerPedId(), false) -- Get the current vehicle
local fuelLevel = exports['qs-fuelstations']:GetFuel(vehicle)
if fuelLevel then
    print("The vehicle's fuel level is: " .. fuelLevel .. "%")
else
    print("Failed to retrieve fuel level.")
end

This export takes the following parameter:

  • vehicle: The entity ID of the vehicle whose fuel level is to be retrieved.

The function returns the fuel level as a percentage (e.g., 50 for 50%). Use this export to integrate fuel data seamlessly into gameplay mechanics or debugging processes.