Exports
You can use the script exports to check, install or remove the thruster package and to get and set a vehicle's air tank level. These exports allow developers to integrate LC Thrusters into their custom scripts, like a mechanic or a dealership selling the package, or an air refill station.
Available Exports
All exports are available only on the server side. vehicle is a server entity handle and plate any plate text (padding and case don't matter).
HasThrusters
This export returns whether the vehicle has the thruster package, by model (Config.Vehicles) or by plate.
local hasThrusters = exports["lc_thrusters"]:HasThrusters(vehicle)IsThrustersInstalled
This export returns whether the package is installed on the plate.
local installed = exports["lc_thrusters"]:IsThrustersInstalled(plate)InstallThrusters
This export installs the package on the plate. It returns true on success.
local success = exports["lc_thrusters"]:InstallThrusters(plate)Example Usage
In this example, a mechanic sells the thruster package and installs it on the vehicle the player is sitting in.
RegisterNetEvent('myMechanic:buyThrusters', function()
local source = source
local vehicle = GetVehiclePedIsIn(GetPlayerPed(source), false)
if vehicle == 0 then
return
end
local plate = GetVehicleNumberPlateText(vehicle)
if exports["lc_thrusters"]:HasThrusters(vehicle) then
return -- Already has it
end
-- Charge the player here
exports["lc_thrusters"]:InstallThrusters(plate)
end)Installing and removing the package by plate needs Config.Database.enabled. Without it, these exports return false.
RemoveThrusters
This export removes the package from the plate. It returns true on success.
local success = exports["lc_thrusters"]:RemoveThrusters(plate)GetTankLevel
This export returns the vehicle's air tank level, from 0 to Config.Tank.capacity. It returns nil if the tank wasn't used yet.
local tankLevel = exports["lc_thrusters"]:GetTankLevel(vehicle)SetTankLevel
This export sets the vehicle's air tank level, from 0 to Config.Tank.capacity. The driver gets the new level at once.
exports["lc_thrusters"]:SetTankLevel(vehicle, 50.0) -- Fill the tank (default capacity)Example Usage
In this example, an air refill station fills the tank of the vehicle the player is sitting in.
RegisterNetEvent('myStation:refillAir', function()
local source = source
local vehicle = GetVehiclePedIsIn(GetPlayerPed(source), false)
if vehicle == 0 or not exports["lc_thrusters"]:HasThrusters(vehicle) then
return
end
exports["lc_thrusters"]:SetTankLevel(vehicle, 50.0)
end)