Client Events
These are client-side events that zephyr_garages sends to all clients (or locally) to keep the garage UI and zone system in sync with server-side changes. Hook them in your own resource to react to garage updates.
zephyr_garages:client:garageRegistered
Fired on all clients when a new garage is registered at runtime via the RegisterGarage export. The client’s zone controller adds the new access points and blips automatically.
AddEventHandler('zephyr_garages:client:garageRegistered', function(name, garageConfig)
print('New garage registered: ' .. name)
-- garageConfig contains label, vehicleType, accessPoints, etc.
end)| Parameter | Type | Description |
|---|---|---|
name | string | Garage identifier key (e.g. "mrpd") |
garageConfig | table | Full garage configuration object |
zephyr_garages:client:garageUpdated
Fired on all clients when an existing garage is updated via RegisterGarage (i.e. the name already exists). The zone controller replaces the old entry.
AddEventHandler('zephyr_garages:client:garageUpdated', function(name, garageConfig)
print('Garage updated: ' .. name)
end)| Parameter | Type | Description |
|---|---|---|
name | string | Garage identifier key |
garageConfig | table | Updated garage configuration object |
zephyr_garages:client:garageAccessUpdated
Fired on all clients when a garage’s allowed identifiers change via the SetGarageAllowedIdentifiers export. Clients use this to re-evaluate whether they can interact with the garage zone.
AddEventHandler('zephyr_garages:client:garageAccessUpdated', function(name, allowedIdentifiers)
-- allowedIdentifiers: table of citizen IDs or player identifiers that can access this garage
print('Access list updated for: ' .. name)
end)| Parameter | Type | Description |
|---|---|---|
name | string | Garage identifier key |
allowedIdentifiers | table | Array of allowed player identifiers |
zephyr_garages:client:towCompleted
Fired on the requesting player’s client after a successful tow action. Use this to show a custom notification or update an external UI.
AddEventHandler('zephyr_garages:client:towCompleted', function(vehicleId, targetGarage, targetGarageLabel)
print(('Vehicle %s towed to %s (%s)'):format(vehicleId, targetGarageLabel, targetGarage))
end)| Parameter | Type | Description |
|---|---|---|
vehicleId | number | Database ID of the towed vehicle |
targetGarage | string | Garage key the vehicle was towed to |
targetGarageLabel | string | Human-readable label of the target garage |
zephyr_garages:client:previewEnded (local event)
A local client event (not sent over the network) fired when a vehicle preview session ends for any reason. Useful for resetting any custom UI state.
AddEventHandler('zephyr_garages:client:previewEnded', function(sessionMeta)
print('Preview ended. Reason: ' .. sessionMeta.reason)
end)sessionMeta fields:
| Field | Type | Description |
|---|---|---|
reason | string | Why the preview ended — see table below |
requestId | string|nil | Internal request ID for the session |
vehicleId | number|nil | Vehicle ID that was being previewed |
Possible reason values:
| Value | Description |
|---|---|
"cleanup" | Default / resource stop |
"vehicle_missing" | Preview vehicle entity no longer exists |
"camera_failed" | Camera entity was destroyed unexpectedly |
"player_dead" | Player died during preview |
"interrupted" | Player walked too far from the access point |
"timeout" | Preview duration limit reached |
"user_exit" | Player pressed Escape / Backspace to close |