Developer Documentation
This page contains technical information for developers who want to integrate with or extend zerio-garage.
Server-Side Exports
Garage Management
GetGarages
Retrieves all configured public garages.
local garages = exports['zerio-garage']:GetGarages()Returns: table - Array of garage configurations
Example:
local garages = exports['zerio-garage']:GetGarages()
for _, garage in ipairs(garages) do
print("Garage: " .. garage.name)
print("Location: " .. json.encode(garage.marker))
endGetImpounds
Retrieves all configured impound lots.
local impounds = exports['zerio-garage']:GetImpounds()Returns: table - Array of impound configurations
GetJobGarages
Retrieves all configured job garages.
local jobGarages = exports['zerio-garage']:GetJobGarages()Returns: table - Array of job garage configurations
GetGangGarages
Retrieves all configured gang garages (QB-Core only).
local gangGarages = exports['zerio-garage']:GetGangGarages()Returns: table - Array of gang garage configurations
Note: This export is only available when the framework supports gang garages (QB-Core).
Housing Integration
OpenHousingGarage
Opens the garage UI for a player, showing their stored vehicles. Used by housing scripts to integrate garage functionality.
exports['zerio-garage']:OpenHousingGarage(source, garageId, label, spawns)Parameters:
source(number): Player server IDgarageId(string): Unique garage identifier (used as database key and for transfers)label(string): Display name shown in UIspawns(vector4ortable<vector4>): One or more spawn points where vehicles will appear
Example:
-- Single spawn point
exports['zerio-garage']:OpenHousingGarage(
source,
"house_123",
"My Beach House",
vector4(-1000.0, 500.0, 30.0, 90.0)
)
-- Multiple spawn points
exports['zerio-garage']:OpenHousingGarage(
source,
"house_456",
"Mansion Garage",
{
vector4(-1000.0, 500.0, 30.0, 90.0),
vector4(-1005.0, 500.0, 30.0, 90.0),
vector4(-1010.0, 500.0, 30.0, 90.0)
}
)Security Note: Your housing script must validate access before calling this export. zerio-garage will perform an additional security check but the primary access control is your responsibility.
StoreHousingVehicle
Stores the vehicle the player is currently sitting in. Used by housing scripts for garage storage functionality.
exports['zerio-garage']:StoreHousingVehicle(source, garageId, label)Parameters:
source(number): Player server IDgarageId(string): Unique garage identifier (must match the one used in OpenHousingGarage)label(string): Display name used in notifications
Example:
exports['zerio-garage']:StoreHousingVehicle(source, "house_123", "My Beach House")Note: The player must be in a vehicle. If not, they’ll receive a notification and nothing happens.
Admin Functions
ReloadGarageConfigs
Reloads all garage configurations from the database and syncs to all clients.
exports['zerio-garage']:ReloadGarageConfigs()Use Case: Call this after manually modifying the database or when you need to force a configuration refresh.
IsAdmin
Checks if a player has admin permissions.
local isAdmin = exports['zerio-garage']:IsAdmin(source)Parameters:
source(number): Player server ID
Returns: boolean - True if player has admin permissions
Client-Side Exports
UI State
IsUIOpen
Checks if the garage UI is currently open.
local isOpen = exports['zerio-garage']:IsUIOpen()Returns: boolean - True if the garage UI is open
Use Case: Use this to prevent other UI interactions while the garage menu is active.
Commands
Admin Commands
| Command | Description | Permission | Framework |
|---|---|---|---|
/garageadmin | Opens the in-game admin panel for managing garages | Admin | Both |
/reloadgarages | Reloads garage configurations from database | Admin | Both |
/admincar [model] | Spawns a vehicle instantly | Admin | ESX only* |
/changeplate | Changes a vehicle’s plate | Admin | Both |
/impound | Impounds nearby vehicle | Police | Both |
* On QB-Core, the /admincar command is disabled by default as qb-core provides its own vehicle spawn command. This can be enabled in configs/features.lua.
Database Structure
Zerio Garage v3 uses a modern database structure with multiple tables:
Main Tables
zerio_garage_configs: Stores all garage configurations (garages, impounds, job/gang garages)zerio_garage_spawn_points: Vehicle spawn points for each garagezerio_garage_putback_points: Points where players can store vehicleszerio_garage_vehicles: Static job/gang vehicles (when not using zerio-bossmenu)
Feature Tables
zerio_garage_vehicle_transfers: Active vehicle transfers between garageszerio_garage_vehicle_shares: Vehicle sharing permissionszerio_garage_active_sales: Pending vehicle sale transactionszerio_garage_vehicle_sales: Completed sales historyzerio_garage_favorite_vehicles: Player’s favorited vehicleszerio_garage_impound_logs: Police impound action logszerio_garage_vehicle_presets: Job vehicle customization presetszerio_garage_showroom_slots: Garage showroom display configurationszerio_garage_custom_labels: Custom vehicle name overrideszerio_garage_private_access: Private garage access control listszerio_garage_admin_audit_log: Admin action audit trail
Schema Modifications
Zerio Garage adds the following column to your framework’s vehicle table:
nickname(varchar): Stores custom vehicle nicknames
QBCore: Adds to player_vehicles table
ESX: Adds to owned_vehicles table
Configuration Files
The resource uses multiple configuration files organized by functionality:
configs/core.lua: Core settings (locale, debug, browser locale)configs/garage.lua: Garage behavior and payment settingsconfigs/vehicle.lua: Vehicle spawning and condition managementconfigs/features.lua: Advanced features (sales, transfers, admin commands)configs/interactions.lua: Interaction system configurationconfigs/logging.lua: Webhook and logging settings
See the Configuration Guide for detailed information.
Custom Interaction Systems
Zerio Garage supports custom interaction systems. See client/interactions/example.lua in the resource for implementation details.
Interface Requirements:
GetName(): Return unique system identifierInit(): Initialize the systemCleanup(): Clean up resourcesShowGarageInteraction(): Display garage interactionHideGarageInteraction(): Hide garage interactionShowPutbackInteraction(): Display putback interactionHidePutbackInteraction(): Hide putback interaction
Framework API
Both frameworks are abstracted through a unified API layer located in framework/client.lua and framework/server.lua. This abstraction layer handles all framework-specific calls internally, making the core code framework-agnostic.