> For the complete documentation index, see [llms.txt](https://docs.menanak47.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.menanak47.com/multi-framework/ak47_garage/events/client.md).

# Client

### Housing Events

These client-side events enable seamless integration with housing and property scripts (such as `ps-housing`, `qb-houses`, `ox_property`, `bcs_housing`, etc.).

#### `ak47_garage:housing:takevehicle`

Opens the Garage UI for a house garage. It displays all compatible player-owned vehicles, suppresses transfer fees, and sets the vehicle spawn point directly at the player's current location/heading.

```lua
TriggerEvent('ak47_garage:housing:takevehicle', gid, garagetype)
```

**Parameters**

| Parameter    | Type     | Required | Description                                                                                |
| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------ |
| `gid`        | `string` | **Yes**  | Unique identifier for the house garage (e.g. `"property_42"` or `"house_vinewood"`).       |
| `garagetype` | `string` | **Yes**  | Vehicle category allowed for this house garage: `"car"`, `"boat"`, `"heli"`, or `"plane"`. |

**Integration Example**

```lua
-- In your housing / property script when interacting with house garage marker
local houseId = "house_104"
local garageType = "car"

RegisterNetEvent('myHousing:openGarage', function(houseId)
    TriggerEvent('ak47_garage:housing:takevehicle', houseId, 'car')
end)
```

***

#### `ak47_garage:housing:storevehicle`

Stores the vehicle the player is currently sitting in into a house garage. Enforces the housing vehicle capacity limit configured in `Config.HousingGarageLimit` and checks trailer compatibility.

```lua
TriggerEvent('ak47_garage:housing:storevehicle', gid, garagetype)
```

**Parameters**

| Parameter    | Type     | Required | Description                                                                      |
| ------------ | -------- | -------- | -------------------------------------------------------------------------------- |
| `gid`        | `string` | **Yes**  | Unique identifier for the house garage.                                          |
| `garagetype` | `string` | **Yes**  | Vehicle category for this house garage (`"car"`, `"boat"`, `"heli"`, `"plane"`). |

**Integration Example**

```lua
-- In your housing / property script when player triggers 'Park Vehicle' at house garage
local houseId = "house_104"

RegisterNetEvent('myHousing:parkVehicle', function(houseId)
    local ped = PlayerPedId()
    if IsPedInAnyVehicle(ped, false) then
        TriggerEvent('ak47_garage:housing:storevehicle', houseId, 'car')
    else
        -- Show prompt to enter vehicle
    end
end)
```

***

### UI & HUD Integration Events

These events are dispatched when the garage UI opens or closes. Third-party UI and HUD scripts (like `ak47_hud` or custom minimap scripts) can listen to these events to toggle radar/HUD elements.

#### `ak47_garage:OnGarageUiOpen`

Triggered immediately when the Garage NUI UI and 3D showroom camera are activated.

```lua
AddEventHandler('ak47_garage:OnGarageUiOpen', function(garageId)
    -- Hide HUD / minimap
    DisplayRadar(false)
end)
```

**Parameters**

| Parameter  | Type     | Description                        |
| ---------- | -------- | ---------------------------------- |
| `garageId` | `string` | The ID of the garage being opened. |

***

#### `ak47_garage:OnGarageUiClose`

Triggered immediately when the Garage UI is closed and the showroom camera is destroyed.

```lua
AddEventHandler('ak47_garage:OnGarageUiClose', function(garageId)
    -- Restore HUD / minimap
    DisplayRadar(true)
end)
```

**Parameters**

| Parameter  | Type     | Description                           |
| ---------- | -------- | ------------------------------------- |
| `garageId` | `string` | The ID of the garage that was closed. |

### Vehicle Spawning & Management

#### `ak47_garage:spawnvehicle`

Dispatched from server to client to finalize client-side vehicle setup upon retrieval from garage.

```lua
RegisterNetEvent('ak47_garage:spawnvehicle', function(nid, properties, pos, trailerData, plate, realparking)
```

**Parameters**

| Parameter     | Type           | Description                                          |
| ------------- | -------------- | ---------------------------------------------------- |
| `nid`         | `number`       | Network ID of the spawned vehicle entity.            |
| `properties`  | `table`        | Vehicle modifications and properties table.          |
| `pos`         | `vector4`      | Spawn coordinates and heading `{x, y, z, w}`.        |
| `trailerData` | `table\|nil`   | Optional trailer vehicle properties table.           |
| `plate`       | `string`       | Vehicle license plate.                               |
| `realparking` | `boolean\|nil` | `true` if spawning from a RealParking unpark action. |

***

#### `ak47_garage:client:applyModsWithTargetPlayer`

Applies vehicle modifications when the vehicle's network owner is another nearby client.

```lua
RegisterNetEvent('ak47_garage:client:applyModsWithTargetPlayer', function(nid, properties)
```

***

#### `ak47_garage:removekey`

Triggered to remove the physical vehicle key from the player upon parking the vehicle.

```lua
RegisterNetEvent('ak47_garage:removekey', function(plate, model)
```

***

#### `ak47_garage:markmap`

Sets a GPS waypoint on the player's minimap and displays an information or warning notification.

```lua
RegisterNetEvent('ak47_garage:markmap', function(pos, msg, msgType)
```

**Parameters**

| Parameter | Type      | Description                                           |
| --------- | --------- | ----------------------------------------------------- |
| `pos`     | `vector3` | Coordinates to place waypoint on.                     |
| `msg`     | `string`  | Notification message text.                            |
| `msgType` | `string`  | Notification type (`"info"`, `"error"`, `"success"`). |

***

### Persistent Vehicles Events

#### `ak47_garage:persistent:applyProperties`

Applies saved properties, body damage, door/window status, engine status, indicators, handbrake, roof state, dirt, and lock states to a persistent vehicle spawned dynamically by the server.

```lua
RegisterNetEvent('ak47_garage:persistent:applyProperties', function(netId, mods, damage, status, fuel, locked)
```

**Parameters**

| Parameter | Type     | Description                                                                                                       |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `netId`   | `number` | Network ID of the vehicle entity.                                                                                 |
| `mods`    | `table`  | Vehicle properties / modifications table.                                                                         |
| `damage`  | `table`  | Visual damage table (doors, tires, windows, engine, body).                                                        |
| `status`  | `table`  | Extended status (`engineOn`, `lightState`, `handbrake`, `roofState`, `dirtLevel`, `radioStation`, `doorslocked`). |
| `fuel`    | `number` | Fuel percentage (0 - 100).                                                                                        |
| `locked`  | `number` | Door lock value (`1` = unlocked, `2` = locked).                                                                   |
