Skip to content

Phone Integration for Developers

This page explains how phone developers can make their phone garage apps work with cd_garage.

If your phone script has a garage app, it should read vehicle status and garage data from the vehicle database table.

  • ESX usually uses owned_vehicles
  • QBCore/Qbox usually uses player_vehicles

Vehicle Status

  • Use the in_garage database column to check where the vehicle is.
  • Your phone script should use this value to show the correct vehicle status in the phone garage app.
lua
local result = exports.oxmysql:fetch('SELECT in_garage FROM owned_vehicles WHERE plate = ?', {
    'ABCD1234'
})

local inGarage = result[1].in_garage
inGarage = 0 -- Vehicle is on the streets
inGarage = 1 -- Vehicle is in a garage
inGarage = 2 -- Vehicle is in impound

print('inGarage: ', inGarage)
-- Example output:
-- inGarage: 1

Garage ID and Label

  • The garage_id database column is the garage’s unique ID.
  • Do not show garage_id directly to players.
  • Use the GetGarageLabelFromGarageId export to get the garage label from the garage ID:
lua
local result = exports.oxmysql:fetch('SELECT garage_id FROM owned_vehicles WHERE plate = ?', {
    'ABCD1234'
})

local garageId = result[1].garage_id -- '0ZDV-42KH-8OSX'
local garageLabel = exports.cd_garage:GetGarageLabelFromGarageId(garageId) -- Legion Garage

print('garageId: ', garageId)
print('garageLabel: ', garageLabel)
-- Example output:
-- garageId: '0ZDV-42KH-8OSX'
-- garageLabel: Legion Garage

This makes sure the phone app shows a clean garage name, such as Legion Garage, instead of a raw garage ID.

Hello!