Exports & events
Server exports
Lua
exports['saf-garage']:GetSavedVehicles(src) -- the player's saved vehicles (id, name, model, plate, class, ...)
exports['saf-garage']:SaveVehicle(src, props, name) -- save props for a player: returns the new id, or nil, reason
exports['saf-garage']:SpawnSaved(src, id) -- take a saved vehicle out, with the same checks as the menuSpawnSaved runs every rule the menu runs: ownership, allowed models, spawn mode and cooldown.
Client exports
Lua
local props = exports['saf-garage']:GetVehicleProperties(vehicle)
exports['saf-garage']:SetVehicleProperties(vehicle, props)These read and apply everything SAF Garage saves: colours, mods, liveries, extras, plate and plate style. You can use them in your own scripts, such as a car dealer or a mechanic menu.
Example: save a car from a dealership
Lua
-- server, in your own dealership resource
RegisterNetEvent('my-dealer:bought', function(props)
local src = source
local id, reason = exports['saf-garage']:SaveVehicle(src, props, 'New car')
if not id then
print(('Could not save for %s: %s'):format(src, reason))
end
end)Hooks after a spawn
There is no event for a spawned vehicle. Use Bridge.OnSpawned(veh, row) in custom/client/ instead. See
Custom servers.