Server Exports
CreatePlayerVehicle
Sets the owner of the vehicle, or if citizenid is nil, sets the vehicle to have no owner.
exports.qbx_vehicles:CreatePlayerVehicle(request)
- request:
table
- model:
string
- citizenid?:
string
- garage?:
string
- props?: ox_lib vehicle properties (opens in a new tab)
- model:
Returns:
- vehicleId?:
integer
- errorResult?:
{code: string, message: string}
Error Codes: N/A
DeletePlayerVehicles
Delete player vehicles matching some identifier. Only handles deleting from the database.
exports.qbx_vehicles:DeletePlayerVehicles(idType, idValue)
- idType:
'citizenid' | 'license' | 'plate' | 'vehicleId'
- idValue:
string | number
Returns:
- success:
boolean
- errorResult?:
{code: string, message: string}
Error Codes: N/A
DoesPlayerVehiclePlateExist
Returns whether a player owned vehicle has the matching plate
exports.qbx_vehicles:DoesPlayerVehiclePlateExist(plate)
- plate:
string
Returns: boolean
GetPlayerVehicle
Queries a player vehicle by vehicleId. Can optionally pass filter criteria.
exports.qbx_vehicles:GetPlayerVehicle(vehicleId, filters)
- vehicleId:
number
- filters?: PlayerVehiclesFilters
Returns: PlayerVehicle?
GetPlayerVehicles
Queries player vehicles by various filter criteria. If no filters are set, queries all vehicles.
exports.qbx_vehicles:GetPlayerVehicles(filters)
- filters?: PlayerVehiclesFilters
Returns: PlayerVehicle[]
SetPlayerVehicleOwner
Sets the owner of the vehicle, or if citizenid is nil, sets the vehicle to have no owner.
exports.qbx_vehicles:SetPlayerVehicleOwner(vehicleId, citizenid)
- vehicleId:
integer
- citizenid?:
string
Returns:
- success:
boolean
- errorResult?:
{code: string, message: string}
Error Codes: N/A
GetVehicleIdByPlate
Looks up the vehicleId with the given plate
exports.qbx_vehicles:GetVehicleIdByPlate(plate)
- plate:
string
Returns vehicleId?: integer
SaveVehicle
Update an existing vehicle's attributes
exports.qbx_vehicles:SaveVehicle(vehicle, options)
- vehicle:
number
entity - options:
table
- garage?:
string
- state?: VehicleState
- depotPrice?:
integer
- props?: ox_lib vehicle properties (opens in a new tab)
- garage?:
Returns:
- success:
boolean
- errorResult?:
{code: string, message: string}
Error Codes:
- not_owned: unable to locate the vehicle's row in the player_vehicles table
Common Types
VehicleState
- OUT = 0
- GARAGED = 1
- IMPOUNDED = 2
PlayerVehicle
- id:
integer
- citizenid?:
string
- modelName:
string
- garage:
string
- state: VehicleState
- depotPrice:
integer
- props: ox_lib vehicle properties (opens in a new tab)
PlayerVehiclesFilters
- citizenid?:
string
- states?:
VehicleState | VehicleState[]
- garage?:
string