> For the complete documentation index, see [llms.txt](https://zloma-scripts.gitbook.io/zloma-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zloma-scripts.gitbook.io/zloma-scripts/zloma_keys-free-escrow/api-reference/client-exports.md).

# Client Exports

Client-side exports allow other resources to give or remove keys on the local player's side, toggle lock state, and check key possession.

***

## GiveKey

Gives a key to the local player by triggering the server to add the key item.

```lua
exports['zloma_keys']:GiveKey(vehicle, plate, model, label)
```

| Parameter | Type          | Description                                                                          |
| --------- | ------------- | ------------------------------------------------------------------------------------ |
| `vehicle` | number \| nil | Vehicle entity handle. If provided, plate/model/label are read from it automatically |
| `plate`   | string \| nil | Vehicle plate. Required if `vehicle` is `nil`                                        |
| `model`   | number \| nil | Vehicle model hash. Optional if `vehicle` is provided                                |
| `label`   | string \| nil | Display label. Optional if `vehicle` is provided                                     |

**Returns:** `boolean` — `true` if the server event was dispatched successfully.

**Example:**

```lua
-- From a vehicle entity
exports['zloma_keys']:GiveKey(vehicle)

-- Without a vehicle entity (e.g. from a garage)
exports['zloma_keys']:GiveKey(nil, plate, model, label)
```

***

## RemoveKey

Requests the server to remove the key item for the given plate from the local player.

```lua
exports['zloma_keys']:RemoveKey(plate)
```

| Parameter | Type   | Description                              |
| --------- | ------ | ---------------------------------------- |
| `plate`   | string | Vehicle plate (automatically normalized) |

**Returns:** `boolean`

***

## HasKey

Checks whether the local player's inventory contains a key for the given plate. Uses a client-side cache.

```lua
exports['zloma_keys']:HasKey(plate)
```

| Parameter | Type   | Description   |
| --------- | ------ | ------------- |
| `plate`   | string | Vehicle plate |

**Returns:** `boolean`

***

## ToggleLock

Toggles the lock state of a vehicle as if the local player used their key.

```lua
exports['zloma_keys']:ToggleLock(vehicle)
```

| Parameter | Type   | Description           |
| --------- | ------ | --------------------- |
| `vehicle` | number | Vehicle entity handle |

**Returns:** `boolean`

***

## StoreVehicleKey

Convenience export for garage integrations. Removes the key when storing a vehicle and gives it back when retrieving.

```lua
exports['zloma_keys']:StoreVehicleKey(vehicle, hasStored)
```

| Parameter   | Type    | Description                                                                                     |
| ----------- | ------- | ----------------------------------------------------------------------------------------------- |
| `vehicle`   | number  | Vehicle entity handle                                                                           |
| `hasStored` | boolean | `true` when the vehicle is being stored (removes key), `false` when being retrieved (gives key) |

**Returns:** `boolean`

**Example:**

```lua
-- Storing vehicle in garage
exports['zloma_keys']:StoreVehicleKey(vehicle, true)

-- Retrieving vehicle from garage
exports['zloma_keys']:StoreVehicleKey(vehicle, false)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://zloma-scripts.gitbook.io/zloma-scripts/zloma_keys-free-escrow/api-reference/client-exports.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
