Resources
Exports
Server

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)

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)

Returns: PlayerVehicle?

GetPlayerVehicles

Queries player vehicles by various filter criteria. If no filters are set, queries all vehicles.

exports.qbx_vehicles:GetPlayerVehicles(filters)

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)

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

PlayerVehiclesFilters

  • citizenid?: string
  • states?: VehicleState | VehicleState[]
  • garage?: string