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

# Keys as inventory items

> Turn car key copies into real items with the plate on them, that players can give, lose or get stolen

By default every key in Vehicles Keys is **virtual**: it lives in the script, not in the inventory. With **Keys are inventory items** on, copies of a key become a real item with the plate written on it. Whoever carries the item can open and start that car.

## Turn it on

**1. Add the item**

Add the `vehicle_key` item to your inventory. The ready-made blocks are in [Installation > Items](https://docs.jaksam-scripts.com/vehicles-keys/installation.md#items).

**2. Open the panel**

Type `/vehiclekeys` and open **Settings**.

**3. Tick the option**

Tick **Keys are inventory items**. The **Key item name** must be the same name you used in the inventory (`vehicle_key` by default).

**4. Save**

Press **Apply changes**.

It is **off by default**: a server that updates sees no change until you turn it on.

> [!WARNING]
>
> It works with **jaksam\_inventory**, **ox\_inventory** (Qbox too) and the **QBCore inventories**, because they keep the plate inside the item. With another inventory the keys stay virtual and the server console says so.

> [!NOTE]
>
> On **QBCore** inventories set the item as `unique = true`. If you don't, keys of different cars stack together.

## Options

| Option | What it does |
| - | - |
| Keys are inventory items | Turns the feature on |
| Key item name | The name of the item in your inventory, `vehicle_key` by default |
| Copies given to other players are items | On by default. A copy given from the keys list arrives as an item |
| Keys found while searching a car are items | Off by default. Keys found with **H** in a car become an item |

## What becomes an item

| Key | Item or virtual |
| - | - |
| A copy the owner gives from the keys list | **Item** (with "Copies given to other players are items" on) |
| Keys found while searching a car | **Item** (with "Keys found while searching a car are items" on) |
| A copy made by a thief with the [key programmer](https://docs.jaksam-scripts.com/vehicles-keys/guides/key-cloning.md) | **Item**, its description says it is a programmed copy |
| The keys of a car the player **owns** | Always **virtual**: they are tied to the database, nobody can steal them |
| Keys given by another script (a garage, a dealership, the `/car` command) | **Virtual** |
| Keys of a [job vehicle](https://docs.jaksam-scripts.com/vehicles-keys/guides/job-vehicles.md) | **Virtual** |
| Keys caught with the [relay attack](https://docs.jaksam-scripts.com/vehicles-keys/guides/keyless-and-relay.md) | **Virtual**, they stop working after a few minutes |

> [!NOTE]
>
> The owner of a car never needs an item to drive it. Items are only for the **copies**.

## What happens to a key item

> [card] Given to someone
>
> The new holder can open and start the car. The old holder can't any more.

> [card] Dropped or lost
>
> Whoever picks it up gets the access. The script checks the inventories every 2 seconds.

> [card] Stolen
>
> A robbed key works for the robber, exactly like a real key.

> [card] Thrown away
>
> Throwing the key away from the keys list removes the item too.

## Change the lock

If a key item is lost or stolen, the owner opens the keys list and presses **Change the lock and take back every copy**. Every key item of that car made **before** that moment stops working, also the ones in other players' pockets and the copies made by thieves. The owner's own key keeps working.

The old items stay in the inventories, but they open nothing. New copies given after the change work normally.

## Temporary copies

A **Temporary copy** given from the keys list is an item too. It says "they stop working at the next server restart" and after a restart it opens nothing. A **Permanent copy** works after a restart, until the owner changes the lock.

Keys found while searching a car are temporary in the same way.

## Garages and dealerships give virtual keys

Today **no export gives the key as an item**. A garage, a dealership or any script that uses `giveVehicleKeysToPlayerId` or `refreshPlayerOwnedVehicles` gives a **virtual** key. This is normal for cars the player owns, because owned cars always keep virtual keys.

## Good to know

* If the player who receives a copy can't carry the item (full inventory), the copy arrives as a virtual key instead
* A player who carries a key item of a car they own sees no difference: their own key is used
* With the option off, everything works as before: copies are virtual and permanent copies are saved in the database


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