zephyr_garagesEventsClient

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)
ParameterTypeDescription
namestringGarage identifier key (e.g. "mrpd")
garageConfigtableFull 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)
ParameterTypeDescription
namestringGarage identifier key
garageConfigtableUpdated 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)
ParameterTypeDescription
namestringGarage identifier key
allowedIdentifierstableArray 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)
ParameterTypeDescription
vehicleIdnumberDatabase ID of the towed vehicle
targetGaragestringGarage key the vehicle was towed to
targetGarageLabelstringHuman-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:

FieldTypeDescription
reasonstringWhy the preview ended — see table below
requestIdstring|nilInternal request ID for the session
vehicleIdnumber|nilVehicle ID that was being previewed

Possible reason values:

ValueDescription
"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