Open Garage Menu

openGarageByGarageId

Description: Opens a garage programmatically using its garageId. You can optionally provide coordinates where the vehicle should spawn.

Usage:

exports['kartik-garages']:openGarageByGarageId(garageId, spawnCoords)

Parameters:

Parameter
Type
Description

garageId

string

The unique identifier of the garage you want to open.

spawnCoords

vector4

(Optional) The coordinates where the vehicle should spawn inside the garage.

Return Value:

  • None.

  • Opens the garage UI for the player calling the export.

Notes:

  • spawnCoords is optional; if omitted, the default garage spawn location will be used.

  • This can be used in custom scripts or for integrating garage access in jobs, events, or missions.

  • Ensure the garageId exists; otherwise, the export will not open any garage.

Example:

local garageId = "pdm_main"
local spawnCoords = vector4(215.3, -810.1, 30.7, 90.0)
exports['kartik-garages']:openGarageByGarageId(garageId, spawnCoords)

This will open the pdm_main garage and spawn the vehicle at the specified coordinates.

Last updated