Skip to content

Garage

Garage

Vehicle management app with location tracking, impound GPS, spawn point resolution, and external resource integration via exports. Supports dynamic spawn/impound points from config, batch registration, and provider callbacks.

Database Tables

TablePurpose
phone_garageVehicle records -- identifier, plate, model, model_name, garage_name, impounded, properties (JSON)
phone_garage_locationsCurrent vehicle locations -- identifier, plate, location_x/y/z, location_updated
phone_garage_location_historyLocation history trail -- identifier, plate, location_x/y/z, created_at

Server Callbacks

CallbackPurpose
gcphone:garage:getVehiclesReturns all vehicles with their current location data
gcphone:garage:getVehicleReturns a single vehicle with full location details
gcphone:garage:updateLocationUpdates/inserts the current location of a vehicle and adds history
gcphone:garage:getLocationHistoryReturns the last 20 location history entries for a vehicle
gcphone:garage:requestVehicleRequests to spawn a vehicle at the nearest spawn point
gcphone:garage:getImpoundLocationReturns the nearest impound location for GPS
gcphone:garage:shareLocationShares a vehicle's location with a contact via phone number
gcphone:garage:storeVehicleReturns a vehicle to the garage (updates garage_name, clears impound)
gcphone:garage:getStatsReturns location request stats for a vehicle

Config Options

lua
Config.Garage = {
    MaxVehicles = 20,
    Impounds    = { { label = '...', x = 0, y = 0, z = 0 }, ... },
    SpawnPoints = { { label = '...', x = 0, y = 0, z = 0, h = 0 }, ... },
}

Exports

Registration (single)

ExportPurpose
RegisterGarageSpawnPoint(id, point)Register a single spawn point
RegisterImpoundLocation(id, point)Register a single impound location

Registration (batch)

ExportPurpose
RegisterGarageSpawnPoints(list, prefix?)Register multiple spawn points at once
RegisterImpoundLocations(list, prefix?)Register multiple impound locations at once

Remove / Clear

ExportPurpose
RemoveGarageSpawnPoint(id)Remove a spawn point by ID
RemoveImpoundLocation(id)Remove an impound location by ID
ClearGarageSpawnPoints(prefix?)Clear spawn points (optionally by prefix)
ClearImpoundLocations(prefix?)Clear impound locations (optionally by prefix)

Provider Callbacks

ExportPurpose
SetSpawnPointProvider(fn)Set a dynamic callback fn(source) -> GaragePoint[] for spawn points
SetImpoundProvider(fn)Set a dynamic callback fn(source) -> GaragePoint[] for impound locations

Query

ExportPurpose
GetGarageSpawnPoints()Returns the static spawn point registry
GetImpoundLocations()Returns the static impound location registry
GetNearestSpawnPoint(source)Returns the nearest spawn point to the player (static + provider)
GetNearestImpound(source)Returns the nearest impound location to the player (static + provider)

Sync

ExportPurpose
SyncVehicle(identifier, plate, model, modelName?, garageName?, impounded?, properties?, coords?)Insert or update a vehicle entry from an external garage resource

Released under GPL-3.0 License