> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roadshop.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Server and client exports for integrating RoadGarage with other scripts

# Exports

Call the exports on `exports.road_garage`. Plates are matched without regard
to case or leading and trailing spaces. For events after every action, see the
[hooks](https://docs.roadshop.org/roadgarage/configuration.md#hooks).

## Garages

### RegisterGarage

Adds or replaces a garage at runtime, for example a house garage from your
housing script. Server.

**id** `string` *required*

Unique garage id, up to 64 characters. Vehicles parked here are stored
under it.

**def** `table` *required*

**properties**

**label** `string`

Name on the screen

**kind** `string` (default: car)

`car`, `boat` or `air`

**coords** `vector4` *required*

Where the player opens the garage

**spawns** `vector4[]`

Parking slots; without them the garage point is used

**owners** `string[]`

Framework identifiers that may use the garage (private garage)

**job** `table`

`{ name = minimum grade }`

**gang** `table`

`{ name = minimum grade }`

**shared** `boolean`

Members see every vehicle parked here

**slots** `number`

Own vehicles one player can park here

**blip** `boolean` (default: true)

Show a blip

**return** `boolean`

`true` when the garage was added.

```lua theme={null}
exports.road_garage:RegisterGarage('house_12', {
    label = 'Vinewood Villa', kind = 'car',
    coords = vector4(x, y, z, h), spawns = { vector4(x, y, z, h) },
    owners = { 'char1:abc' },
})
```

### RemoveGarage

Removes a garage added with `RegisterGarage`. Garages from `config.lua` cannot
be removed. Server.

**id** `string` *required*

**return** `boolean`

## Vehicles

### GetVehicle

**plate** `string` *required*

**return** `table | nil`

**properties**

**plate** `string`

Plate

**owner** `string`

Framework identifier of the owner

**state** `string`

`stored`, `out` or `impounded`

**garage** `string`

Garage id

### StoreVehicle

Parks a vehicle that is out but no longer exists in the world, or that is
impounded, in a garage. Server.

**plate** `string` *required*

**garageId** `string` *required*

**return** `boolean`

`false` when the vehicle is already parked, still drives around, or the
garage does not exist.

### IsVehicleOut

**plate** `string` *required*

**return** `boolean`

`true` while the vehicle is out and exists in the world.

### ImpoundVehicle

Impounds a vehicle, for parking tickets or police scripts. A vehicle in the
world is removed. Server.

**plate** `string` *required*

**data** `table`

**properties**

**lot** `string` *required*

Impound lot id from `Config.ImpoundLots`

**reason** `string`

Up to 120 characters

**fee** `number`

Release fee, default `Config.Impound.DefaultFee`, capped at `MaxFee`

**hours** `number`

Hold time, capped at `Config.Impound.MaxHours`

**officer** `string`

Shown to the owner, default the calling resource

**return** `boolean`

`false` when the vehicle does not exist, is already impounded or the lot
does not exist.

```lua theme={null}
exports.road_garage:ImpoundVehicle(plate, { lot = 'city', reason = 'Parking ticket', fee = 500, hours = 1 })
```

## Keys

### AddKeyHolder

Gives a player access to a vehicle as if the owner had shared it. Server.

**plate** `string` *required*

**identifier** `string` *required*

Framework identifier of the player

**name** `string`

Shown in the owner's key list

**return** `boolean`

### RemoveKeyHolder

**plate** `string` *required*

**identifier** `string` *required*

**return** `boolean`

## Mileage

### GetMileage

**plate** `string` *required*

**return** `table | nil`

`{ mileage, serviceIn }` in `Config.Mileage.Unit`.

### ServiceVehicle

Marks a vehicle as serviced at its current mileage, for mechanic scripts.
Server.

**plate** `string` *required*

**return** `boolean`

## Phone apps

RoadPhone's Garage app uses these exports. Server.

### GetPlayerVehicles

**source** `number` *required*

Player server id

**return** `table | nil`

`{ vehicles, unit }`, or `nil` while RoadGarage starts. Each vehicle has
`plate`, `model`, `modelName`, `nickname`, `status` (`stored`, `out`,
`lost`, `impounded`), `garage`, `garageLabel`, `access` (`owner` or
`shared`), `fuel`, `engine`, `body`, `odometer`, `coords` (while out) and
`impound` (while impounded).

### GetAccess

**source** `number` *required*

**plate** `string` *required*

**return** `string | nil`

`owner` or `shared` when the player may use the vehicle, otherwise `nil`.

### DeliverVehicle

Takes a parked land vehicle of the player (owner or key holder) out of its
garage and spawns it at a point, for a valet service. Distance and payment
are the caller's job.

**source** `number` *required*

**plate** `string` *required*

**coords** `vector4` *required*

Where the vehicle spawns

**vehicleType** `string`

Spawn type hint, for example `automobile` or `bike`; the type saved with the vehicle wins

**return** `table`

`{ ok = true, netId }`, or `{ ok = false, error }` with an error such as
`impounded`, `already_out`, `lost` or `bad_coords`.

```lua theme={null}
local result = exports.road_garage:DeliverVehicle(source, 'RG 2041', vector4(x, y, z, h), 'automobile')
if result.ok then
    -- the vehicle is out, result.netId is its network id
end
```

## Client

### OpenGarage

Opens a garage's screen for the local player, for example from your own
interaction. The server still checks access and distance.

**garageId** `string` *required*

### OpenImpound

**lotId** `string` *required*

### StoreVehicle

Parks the vehicle the local player is driving in the given garage.

**garageId** `string` *required*

### CloseGarage

Closes the garage screen.

```lua theme={null}
exports.road_garage:OpenGarage('pillbox')
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.