Exports

Client Exports

GetVehicleStatus

Retrieves a table of the extra damage components and status variables eg, harness

Example Usage:

local vehicle = GetVehiclePedIsIn(PlayerPedId())
local vehicleStatus = exports["jim-mechanic"]:GetVehicleStatus(vehicle)
print(json.encode(vehicleStatus , { indent = true })

SetVehicleStatus

Can be used to alter vehicle status variables, eg toggling harness on a vehicle or repairing extra damages

Example Usage:

local vehicle = GetVehiclePedIsIn(PlayerPedId())
exports["jim-mechanic"]:SetVehicleStatus(vehicle, "harness", 1)

DamageRandomComponent

This triggers the same event called when crashing a vehicle, picking a random part to damage

Example Usage:

local vehicle = GetVehiclePedIsIn(PlayerPedId())
exports["jim-mechanic"]:DamageRandomComponent(vehicle)

HasHarness

Retrieves if the user currently has a harness buckled while in a car

Example Usage:

local harnessOn = exports["jim-mechanic"]:HasHarness()

seatBeltOn

Retrieves if the user currently has a seatbelt buckled while in a car

Example Usage:

local seatbeltOn = exports["jim-mechanic"]:seatBeltOn()

GetNosLevel

Retrieves the current Nos status of a vehicle

Example Usage:

local vehicle = GetVehiclePedIsIn(PlayerPedId())
local nosLevel, hasNos = exports["jim-mechanic"]:GetNosLevel(vehicle)

print("Vehicle Nos Status:", tostring(hasNos))
print("Current Nos Level:", tostring(nosLevel))

GetInPreview

When a player uses /preview or /previewrgb this toggles a variable to stop users doing anything else to it leading to exploits, this can be called outside of the script to stop other scripts from allowing exploits during this process

Example Usage

local inPreview = exports["jim-mechanic"]:GetInPreview()
print("Player preview mode:", tostring(inPreview))

updateVehicle

Simply, complies the vehicle status table to save it to the database on command

Example Usage

local vehicle = GetVehiclePedIsIn(PlayerPedId())
exports["jim-mechanic"]:updateVehicle(vehicle)

GetMilage

Example Usage

local milage = exports["jim-mechanic"]:GetMilage(plate)
print("Current Milage:" tostring(milage))

This retreives the raw value of the milage from the database


IsVehicleOwned

Example Usage:

local owned = exports["jim-mechanic"]:IsVehicleOwned(plate)
if owned then
    print("This vehicle is owned")
else
    print("This vehicle is NOT owned")
end

Checks the database for if the plate is attached to an owned vehicle


Server Exports

GetMilage

Example Usage

local milage = exports["jim-mechanic"]:GetMilage(plate)
print("Current Milage:" tostring(milage))

This retreives the raw value of the milage from the database


IsVehicleOwned

Example Usage:

local owned = exports["jim-mechanic"]:IsVehicleOwned(plate)
if owned then
    print("This vehicle is owned")
else
    print("This vehicle is NOT owned")
end

Checks the database for if the plate is attached to an owned vehicle


Last updated