> For the complete documentation index, see [llms.txt](https://tgiann.gitbook.io/tgiann/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tgiann.gitbook.io/tgiann/scripts/tgiann-realparking/exports.md). Agents can also search and read this documentation through its [MCP server](https://tgiann.gitbook.io/tgiann/~gitbook/mcp).

# Exports

Every export can be called with an upper or lower case first letter (`GetInsurance` / `getInsurance`).

## Client

### OpenGarage

Opens the garage menu of a slot for the local player. Use it with `isCustom = true` for garages that are not in the garage list (housing, custom garages). The `canAction` check in `client/editable.lua` runs first.

```lua
exports["tgiann-realparking"]:OpenGarage("pd_normal_1", 2, false)
-- housing garage
exports["tgiann-realparking"]:OpenGarage("my_house", 1, true)
```

#### Parameters

* **garageKey**: `string` unique garage key
* **slotIndex**: `number` slot number
* **isCustom**: `boolean` custom garage that is not in the garage list

***

### ParkGarage

Parks the vehicle the local player is sitting in. Does nothing when the player is not in a vehicle. The `canAction` check in `client/editable.lua` runs first.

```lua
exports["tgiann-realparking"]:ParkGarage("pd_normal_1", 2, false)
-- housing garage
exports["tgiann-realparking"]:ParkGarage("my_house", 1, true)
```

#### Parameters

* **garageKey**: `string` unique garage key
* **slotIndex**: `number` slot number
* **isCustom**: `boolean` custom garage that is not in the garage list

## Server

### GetPlayerVehicleDetails

Returns every vehicle of a player with its live state: parked in a garage, out in the world or impounded, plus insurance, fine and share info. Without `job` the vehicles shared with the player are included too. Yields; right after a resource start it waits (up to 15 seconds) until the garages are loaded.

```lua
local vehicles = exports["tgiann-realparking"]:GetPlayerVehicleDetails(citizenid)
```

#### Parameters

* **citizenid**: `string` character identifier
* **job?**: `string` only return the vehicles of this job, shared vehicles are left out

#### Returns

* `table[]` one entry per vehicle:
  * **plate**: `string`
  * **properties**: `table` vehicle properties
  * **state**: `"garaged" | "out" | "impounded"`
  * **insurance**: `{ daysLeft: number | false, towing: number }`
  * **job?**: `string` job of the vehicle
  * **garageKey?**, **slotIndex?**, **garageLabel?**, **isRealParking?**, **coords?**: where the vehicle is parked (`garaged`)
  * **netId?**: `number` network id of the vehicle (`out`)
  * **impound?**: `{ reason?: string, fine: number, finishUnixTime?: number, feeByType: { car, air, boat }, fee: number }` (`impounded`, or `out` with an active fine)
  * **sharedFrom?**: `{ ownerCid: string, ownerName: string }` set when the vehicle is shared with this player
  * **sharedTo**: `{ cid: string, name: string }[]` players this vehicle is shared with

***

### TakeVehicleOut

Removes the parked record of a vehicle so you can spawn it yourself (valet, phone apps). It does not spawn anything. Parked records of garages that no longer exist are cleared too.

```lua
local removed = exports["tgiann-realparking"]:TakeVehicleOut("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `boolean` whether the vehicle was removed from its garage

***

### GetGarageList

Returns all garages and impounds with the position of their first slot.

```lua
local garages = exports["tgiann-realparking"]:GetGarageList()
```

#### Returns

* `table<string, { label: string, type: "garage" | "impound", vehicleType: string, jobs?: string[], x: number, y: number, z: number }>` keyed by garage key

***

### IsVehicleParkedAnyGarage

Checks whether a vehicle is parked in any garage.

```lua
local parked = exports["tgiann-realparking"]:IsVehicleParkedAnyGarage("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `boolean`

***

### GetVehicleParkedGarage

Returns the garage a vehicle is parked in.

```lua
local parked = exports["tgiann-realparking"]:GetVehicleParkedGarage("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `{ garageKey: string, slotIndex?: number } | nil` nil when the vehicle is not parked

***

### GetInsurance

Returns the insurance state of a vehicle. Yields (database query).

```lua
local daysLeft, towing = exports["tgiann-realparking"]:GetInsurance("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `number | false` days of insurance left, false when not insured or the insurance system is disabled
* `number` towing count, raises the impound fee of uninsured vehicles

***

### ChangedVehiclePlate

Call this from your plate change script after the plate of a vehicle changed. Moves the insurance and share records to the new plate.

```lua
exports["tgiann-realparking"]:ChangedVehiclePlate("ABC123A", "BCA213B")
```

#### Parameters

* **oldPlate**: `string`
* **newPlate**: `string`

***

### GetImpoundData

Returns the active police fine of a vehicle. Returns nil when there is no fine or its time is over.

```lua
local impound = exports["tgiann-realparking"]:GetImpoundData("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `{ plate: string, reason?: string, fine: number, finishUnixTime: number, secondsLeft: number } | nil` `fine` is what the owner pays to take the vehicle out now, early pickup price included

***

### ImpoundVehicle

Sends a player vehicle to the impound. A parked vehicle is removed from its garage, a vehicle out in the world is deleted. Pass `minute` and/or `money` to also write a fine. Triggers the `tgiann-realparking:vehicleImpounded` event.

```lua
local ok, err = exports["tgiann-realparking"]:ImpoundVehicle("ABC123A", { reason = "Unpaid tax", minute = 60, money = 500 })
```

#### Parameters

* **plate**: `string`
* **options?**: `table`
  * **reason?**: `string` fine reason shown to the owner
  * **minute?**: `number` fine duration in minutes
  * **money?**: `number` fine amount
  * **deleteVehicle?**: `boolean` delete the vehicle when it is out in the world, default `true`

#### Returns

* `boolean` whether the vehicle was impounded
* `string?` error code: `INVALID`, `ALREADY_IMPOUNDED`, `NOT_OWNED`, `NOTHING_TO_IMPOUND`

***

### ReleaseImpound

Removes the police fine of a vehicle. The owner still pays the normal tow fee at the impound.

```lua
local released = exports["tgiann-realparking"]:ReleaseImpound("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `boolean` false when the vehicle had no fine

***

### ShareVehicle

Shares a vehicle with another character, the target does not need to be online. Follows `config.carShare.maxSharePerVehicle`. Yields.

```lua
local ok, err = exports["tgiann-realparking"]:ShareVehicle(ownerCid, "ABC123A", targetCid)
```

#### Parameters

* **ownerCid**: `string` identifier of the vehicle owner
* **plate**: `string`
* **targetCid**: `string` identifier of the character to share with

#### Returns

* `boolean` whether the vehicle was shared
* `string?` error code: `SHARE_DISABLED`, `INVALID`, `NOT_OWNER`, `SELF`, `PLAYER_NOT_FOUND`, `ALREADY_SHARED`, `LIMIT_REACHED`

***

### UnshareVehicle

Removes the share of a vehicle from one character. Yields.

```lua
local ok, err = exports["tgiann-realparking"]:UnshareVehicle(ownerCid, "ABC123A", targetCid)
```

#### Parameters

* **ownerCid**: `string` identifier of the vehicle owner
* **plate**: `string`
* **targetCid**: `string` identifier of the character to remove

#### Returns

* `boolean` whether the share was removed
* `string?` error code: `SHARE_DISABLED`, `INVALID`, `NOT_OWNER`, `NOT_SHARED`

***

### GetVehicleShares

Returns the characters a vehicle is shared with, sorted by name.

```lua
local shares = exports["tgiann-realparking"]:GetVehicleShares("ABC123A")
```

#### Parameters

* **plate**: `string`

#### Returns

* `{ cid: string, name: string }[]` empty when sharing is disabled

***

### IsVehicleSharedWith

Checks whether a vehicle is shared with a character.

```lua
local shared = exports["tgiann-realparking"]:IsVehicleSharedWith("ABC123A", citizenid)
```

#### Parameters

* **plate**: `string`
* **citizenid**: `string`

#### Returns

* `boolean` always false when sharing is disabled

***

### RemoveVehicleShares

Removes every share of a vehicle, for example when it is sold or deleted.

```lua
exports["tgiann-realparking"]:RemoveVehicleShares("ABC123A")
```

#### Parameters

* **plate**: `string`

***

### UpdateSharePlate

Moves the shares of a vehicle to its new plate. `ChangedVehiclePlate` already calls this, use it only when you move shares alone.

```lua
exports["tgiann-realparking"]:UpdateSharePlate("ABC123A", "BCA213B")
```

#### Parameters

* **oldPlate**: `string`
* **newPlate**: `string`

## Events

### tgiann-realparking:openCloseBlips

Client event. Toggles the garage blips on the map.

```lua
TriggerEvent("tgiann-realparking:openCloseBlips")
```

***

### tgiann-realparking:openPoliceImpound

Client event. Opens the police impound menu, only works for the jobs in `config.policeJobs`.

```lua
TriggerEvent("tgiann-realparking:openPoliceImpound")
```

***

### tgiann-realparking:vehicleImpounded

Server event, fired after a player vehicle is impounded (police menu or `ImpoundVehicle`). Listen to it to notify the owner.

```lua
AddEventHandler("tgiann-realparking:vehicleImpounded", function(plate, ownerCid, reason)
    print(plate, ownerCid, reason)
end)
```

#### Parameters

* **plate**: `string` normalized plate
* **ownerCid**: `string` identifier of the vehicle owner
* **reason?**: `string` fine reason, nil for a tow without fine
