Server Side Exports
Vehicle Fuel Management
GetFuel
Gets the fuel level of a vehicle from server side using state bags.
local fuel = exports['lyre_fuel']:GetFuel(vehicleNetId)Parameters:
vehicleNetId
number
The vehicle network ID
Returns:
number
The current fuel level (0-100), or -1 if vehicle not found. Returns 100 if fuel state not set.
Example:
local vehicleNetId = NetworkGetNetworkIdFromEntity(vehicle)
local fuel = exports['lyre_fuel']:GetFuel(vehicleNetId)
if fuel >= 0 then
print("Vehicle fuel: " .. fuel .. "%")
endSetFuel
Sets the fuel level of a vehicle from server side using state bags.
local success = exports['lyre_fuel']:SetFuel(vehicleNetId, fuel)Parameters:
vehicleNetId
number
The vehicle network ID
fuel
number
The fuel level to set (0-100)
Returns:
boolean
Whether the operation was successful
Example:
GetFuelType
Gets the fuel type of a vehicle based on its model.
Parameters:
vehicleNetId
number
The vehicle network ID
Returns:
string or nil
The fuel type key (e.g., "general", "diesel", "electric"), or nil if vehicle not found
Example:
Station Data Retrieval
GetAllStations
Returns all stations data.
Parameters: None
Returns:
table
All stations indexed by station ID
Example:
GetStationById
Returns a specific station by its ID.
Parameters:
stationId
string
The station ID
Returns:
table or nil
The station data table, or nil if not found
Returned Table Structure:
Example:
GetStationsByOwner
Returns all stations owned by a specific player.
Parameters:
ownerIdentifier
string
The owner identifier (e.g., "char1:abc123")
Returns:
table
Array of station data tables owned by the player (empty array if none)
Example:
GetStationName
Returns the name of a station.
Parameters:
stationId
string
The station ID
Returns:
string or nil
The station name, or nil if not found
Example:
GetStationOwner
Returns the owner identifier of a station.
Parameters:
stationId
string
The station ID
Returns:
string or nil
The owner identifier, or nil if not found or no owner
Example:
GetStationState
Returns the state of a station (OPEN or CLOSED).
Parameters:
stationId
string
The station ID
Returns:
string or nil
The station state ("OPEN" or "CLOSED"), or nil if not found
Example:
GetStationSellState
Returns whether a station is for sale.
Parameters:
stationId
string
The station ID
Returns:
boolean or nil
Whether the station is for sale, or nil if not found
Example:
GetStationSellPrice
Returns the sell price of a station.
Parameters:
stationId
string
The station ID
Returns:
number or nil
The sell price, or nil if not found
Example:
GetStationFuelTypes
Returns all fuel types available at a station.
Parameters:
stationId
string
The station ID
Returns:
table or nil
The fuel types table, or nil if not found
Returned Table Structure:
Example:
GetFuelPrice
Returns the price per unit of a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
Returns:
number or nil
The price per unit, or nil if not found
Example:
GetStationStock
Returns the current stock of a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
Returns:
number or nil
The current stock, or nil if not found
Example:
Station Account Management
GetStationAccount
Returns the account balance of a station.
Parameters:
stationId
string
The station ID
Returns:
number or nil
The station account balance, or nil if not found
Example:
SetStationAccount
Sets the account balance of a station.
Parameters:
stationId
string
The station ID
amount
number
The new account balance (minimum 0)
Returns:
boolean
Whether the operation was successful
Example:
AddStationAccount
Adds money to a station account balance.
Parameters:
stationId
string
The station ID
amount
number
The amount to add (must be positive)
Returns:
boolean
Whether the operation was successful
Example:
RemoveStationAccount
Removes money from a station account balance.
Parameters:
stationId
string
The station ID
amount
number
The amount to remove (must be positive, balance won't go below 0)
Returns:
boolean
Whether the operation was successful
Example:
Station Stock Management
SetStationStock
Sets the current stock of a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
stock
number
The new stock value (capped at max stock)
Returns:
boolean
Whether the operation was successful
Example:
AddStationStock
Adds stock to a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
amount
number
The amount to add (must be positive, capped at max stock)
Returns:
boolean
Whether the operation was successful
Example:
RemoveStationStock
Removes stock from a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
amount
number
The amount to remove (must be positive, stock won't go below 0)
Returns:
boolean
Whether the operation was successful
Example:
Station Configuration
SetStationName
Sets the name of a station.
Parameters:
stationId
string
The station ID
name
string
The new station name (non-empty string)
Returns:
boolean
Whether the operation was successful
Example:
SetStationOwner
Sets the owner of a station.
Parameters:
stationId
string
The station ID
ownerIdentifier
string or nil
The new owner identifier, or nil to remove owner
Returns:
boolean
Whether the operation was successful
Example:
SetStationState
Sets the state of a station (OPEN or CLOSED).
Parameters:
stationId
string
The station ID
state
string
The new state ("OPEN" or "CLOSED")
Returns:
boolean
Whether the operation was successful
Example:
SetStationSellState
Sets whether a station is for sale.
Parameters:
stationId
string
The station ID
sellState
boolean
Whether the station should be for sale
sellPrice
number or nil
The sell price (optional, uses current price if not provided)
Returns:
boolean
Whether the operation was successful
Example:
SetStationSellPrice
Sets the sell price of a station.
Parameters:
stationId
string
The station ID
price
number
The new sell price (minimum 0)
Returns:
boolean
Whether the operation was successful
Example:
SetFuelPrice
Sets the price per unit of a fuel type at a station.
Parameters:
stationId
string
The station ID
fuelType
string
The fuel type key (e.g., "general", "diesel", "electric")
price
number
The new price per unit (minimum 0)
Returns:
boolean
Whether the operation was successful
Example:
Vehicle Blacklist Management
AddVehicleToBlacklist
Temporarily adds a specific vehicle to the refuel blacklist.
Parameters:
vehicleNetId
number
The vehicle network ID
duration
number or nil
Duration in seconds (nil or -1 for permanent until restart)
Returns:
boolean
Whether the operation was successful
Example:
RemoveVehicleFromBlacklist
Removes a specific vehicle from the temporary refuel blacklist.
Parameters:
vehicleNetId
number
The vehicle network ID
Returns:
boolean
Whether the operation was successful
Example:
IsVehicleBlacklisted
Checks if a specific vehicle is in the temporary blacklist.
Parameters:
vehicleNetId
number
The vehicle network ID
Returns:
boolean
Whether the vehicle is blacklisted
Example:
Utility Functions
GetScriptConfiguration
Returns the full script configuration.
Parameters: None
Returns:
table
The script configuration table (Config)
Example:
RefreshAllClients
Forces all clients to refresh their station data.
Parameters: None
Returns: None (void)
Example:
Quick Reference
Getters
GetFuel
vehicleNetId
number
Get vehicle fuel level
GetFuelType
vehicleNetId
string/nil
Get vehicle fuel type
GetAllStations
-
table
Get all stations
GetStationById
stationId
table/nil
Get station by ID
GetStationsByOwner
ownerIdentifier
table
Get stations by owner
GetStationName
stationId
string/nil
Get station name
GetStationOwner
stationId
string/nil
Get station owner
GetStationState
stationId
string/nil
Get station state
GetStationSellState
stationId
boolean/nil
Get if station is for sale
GetStationSellPrice
stationId
number/nil
Get station sell price
GetStationAccount
stationId
number/nil
Get station balance
GetStationFuelTypes
stationId
table/nil
Get station fuel types
GetFuelPrice
stationId, fuelType
number/nil
Get fuel price at station
GetStationStock
stationId, fuelType
number/nil
Get fuel stock at station
GetScriptConfiguration
-
table
Get script config
IsVehicleBlacklisted
vehicleNetId
boolean
Check if vehicle is blacklisted
Setters
SetFuel
vehicleNetId, fuel
boolean
Set vehicle fuel level
SetStationName
stationId, name
boolean
Set station name
SetStationOwner
stationId, ownerIdentifier
boolean
Set station owner
SetStationState
stationId, state
boolean
Set station state
SetStationSellState
stationId, sellState, sellPrice?
boolean
Set if station is for sale
SetStationSellPrice
stationId, price
boolean
Set station sell price
SetStationAccount
stationId, amount
boolean
Set station balance
SetStationStock
stationId, fuelType, stock
boolean
Set fuel stock
SetFuelPrice
stationId, fuelType, price
boolean
Set fuel price
Modifiers
AddStationAccount
stationId, amount
boolean
Add to station balance
RemoveStationAccount
stationId, amount
boolean
Remove from station balance
AddStationStock
stationId, fuelType, amount
boolean
Add fuel stock
RemoveStationStock
stationId, fuelType, amount
boolean
Remove fuel stock
AddVehicleToBlacklist
vehicleNetId, duration?
boolean
Blacklist a vehicle
RemoveVehicleFromBlacklist
vehicleNetId
boolean
Remove from blacklist
Utility
RefreshAllClients
-
void
Force refresh all clients
Last updated