Turn it on
1
Add the item
Add the
vehicle_key item to your inventory. The ready-made blocks are in Installation > 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.
On QBCore inventories set the item as
unique = true. If you don’t, keys of different cars stack together.Options
What becomes an item
The owner of a car never needs an item to drive it. Items are only for the copies.
What happens to a key item
Given to someone
The new holder can open and start the car. The old holder can’t any more.
Dropped or lost
Whoever picks it up gets the access. The script checks the inventories every 2 seconds.
Stolen
A robbed key works for the robber, exactly like a real key.
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 usesgiveVehicleKeysToPlayerId 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
