Vehicle Keys uses eight inventory items. Each name is read from config/main.lua, so you can rename any of them — rename it in your inventory too, or the two stop matching.
Item | Config field | Usable | What it does |
|---|---|---|---|
|
| Yes | Locks or unlocks the car whose plate it carries. Must not stack, so every key keeps its own plate. |
|
| Yes | The master key: locks or unlocks the nearest vehicle, and gives admins access to every car while carried. |
|
| Yes | Starts the lockpick on the nearest locked vehicle. |
|
| Yes | The same, and it can skip the police requirement. |
|
| Yes | Fits the plate number it carries to the nearest vehicle. Must not stack. |
|
| No | Has to be carried to swap a plate. Never used up. |
|
| Yes | The tracker itself: fitted to the nearest vehicle and used up. Removing a tracker gives it back. |
|
| Yes | The handheld receiver: opens the list of tracked cars. Also required for |
What a Key Carries#
Every key is created with this metadata, and it is what every check reads:
{
plate = 'ABC 123', -- upper-case, trimmed
model = 'SULTAN', -- the vehicle's name, upper-case
description = 'SULTAN ABC 123' -- what the inventory shows
}A plate item carries the same idea — { plate = 'XYZ 789', description = 'XYZ 789' }. Plates bought at the copy shop come with a fresh number nobody owns yet, and on ox_inventory any plate created without one is given a number automatically.
Item Definitions#
Pick your inventory, paste the block into its item list and restart the inventory. Add a picture named after each item (vehiclekeys.png, plate.png…) to the inventory's image folder.
Add to ox_inventory/data/items.lua. The plate, GPS and tracker are used through the script's own exports, set with client.export:
['vehiclekeys'] = {
label = 'Vehicle Keys',
weight = 0,
stack = false,
close = true,
description = 'Keys to a vehicle',
},
['adminvehiclekey'] = {
label = 'Admin Vehicle Key',
weight = 0,
stack = false,
close = true,
description = 'Master key that opens any vehicle',
},
['carlockpick'] = {
label = 'Lockpick',
weight = 500,
stack = true,
close = true,
description = 'Used to break into vehicles',
},
['caradvancedlockpick'] = {
label = 'Advanced Lockpick',
weight = 500,
stack = true,
close = true,
description = 'A sturdier lockpick for tougher locks',
},
['plate'] = {
label = 'License Plate',
weight = 500,
stack = false,
close = true,
consume = 0,
description = 'A vehicle license plate',
client = {
export = 'qs-vehiclekeys.usePlate',
},
},
['screwdriver'] = {
label = 'Screwdriver',
weight = 500,
stack = true,
close = true,
description = 'Handy for swapping plates',
},
['vehiclegps'] = {
label = 'Vehicle GPS',
weight = 500,
stack = true,
close = true,
consume = 0,
description = 'Installs a GPS tracker on a vehicle',
client = {
export = 'qs-vehiclekeys.useGps',
},
},
['vehicletracker'] = {
label = 'Vehicle Tracker',
weight = 500,
stack = true,
close = true,
consume = 0,
description = 'Locates a tracked vehicle',
client = {
export = 'qs-vehiclekeys.useTracker',
},
},On ESX and QBCore the keys and lockpicks are registered as usable through the framework, so they need no export. A standalone server has no framework to register them with — give those three an export as well:
-- standalone only
client = { export = 'qs-vehiclekeys.useKey' }, -- inside 'vehiclekeys'
client = { export = 'qs-vehiclekeys.useLockpick' }, -- inside 'carlockpick'
client = { export = 'qs-vehiclekeys.useAdvancedLockpick' }, -- inside 'caradvancedlockpick'Pictures go in ox_inventory/web/images/.
Add to qb-core/shared/items.lua. unique = true on the key keeps every key in its own slot with its own plate:
['vehiclekeys'] = { ['name'] = 'vehiclekeys', ['label'] = 'Vehicle Keys', ['weight'] = 0, ['type'] = 'item', ['image'] = 'vehiclekeys.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Keys to a vehicle' },
['adminvehiclekey'] = { ['name'] = 'adminvehiclekey', ['label'] = 'Admin Vehicle Key', ['weight'] = 0, ['type'] = 'item', ['image'] = 'adminvehiclekey.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Master key that opens any vehicle' },
['carlockpick'] = { ['name'] = 'carlockpick', ['label'] = 'Lockpick', ['weight'] = 500, ['type'] = 'item', ['image'] = 'carlockpick.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Used to break into vehicles' },
['caradvancedlockpick'] = { ['name'] = 'caradvancedlockpick', ['label'] = 'Advanced Lockpick', ['weight'] = 500, ['type'] = 'item', ['image'] = 'caradvancedlockpick.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A sturdier lockpick for tougher locks' },
['plate'] = { ['name'] = 'plate', ['label'] = 'License Plate', ['weight'] = 500, ['type'] = 'item', ['image'] = 'plate.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A vehicle license plate' },
['screwdriver'] = { ['name'] = 'screwdriver', ['label'] = 'Screwdriver', ['weight'] = 500, ['type'] = 'item', ['image'] = 'screwdriver.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Handy for swapping plates' },
['vehiclegps'] = { ['name'] = 'vehiclegps', ['label'] = 'Vehicle GPS', ['weight'] = 500, ['type'] = 'item', ['image'] = 'vehiclegps.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Installs a GPS tracker on a vehicle' },
['vehicletracker'] = { ['name'] = 'vehicletracker', ['label'] = 'Vehicle Tracker', ['weight'] = 500, ['type'] = 'item', ['image'] = 'vehicletracker.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Locates a tracked vehicle' },Pictures go in qb-inventory/html/images/.
Add to qs-inventory/shared/items.lua:
['vehiclekeys'] = { ['name'] = 'vehiclekeys', ['label'] = 'Vehicle Keys', ['weight'] = 0, ['type'] = 'item', ['image'] = 'vehiclekeys.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Keys to a vehicle' },
['adminvehiclekey'] = { ['name'] = 'adminvehiclekey', ['label'] = 'Admin Vehicle Key', ['weight'] = 0, ['type'] = 'item', ['image'] = 'adminvehiclekey.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Master key that opens any vehicle' },
['carlockpick'] = { ['name'] = 'carlockpick', ['label'] = 'Lockpick', ['weight'] = 500, ['type'] = 'item', ['image'] = 'carlockpick.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Used to break into vehicles' },
['caradvancedlockpick'] = { ['name'] = 'caradvancedlockpick', ['label'] = 'Advanced Lockpick', ['weight'] = 500, ['type'] = 'item', ['image'] = 'caradvancedlockpick.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A sturdier lockpick for tougher locks' },
['plate'] = { ['name'] = 'plate', ['label'] = 'License Plate', ['weight'] = 500, ['type'] = 'item', ['image'] = 'plate.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A vehicle license plate' },
['screwdriver'] = { ['name'] = 'screwdriver', ['label'] = 'Screwdriver', ['weight'] = 500, ['type'] = 'item', ['image'] = 'screwdriver.png', ['unique'] = false, ['useable'] = false, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Handy for swapping plates' },
['vehiclegps'] = { ['name'] = 'vehiclegps', ['label'] = 'Vehicle GPS', ['weight'] = 500, ['type'] = 'item', ['image'] = 'vehiclegps.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Installs a GPS tracker on a vehicle' },
['vehicletracker'] = { ['name'] = 'vehicletracker', ['label'] = 'Vehicle Tracker', ['weight'] = 500, ['type'] = 'item', ['image'] = 'vehicletracker.png', ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'Locates a tracked vehicle' },Pictures go in qs-inventory/html/images/.
codem-inventory and tgiann-inventory are reached through your framework's own item functions. Register the same eight items in that inventory's item list, with these three rules:
vehiclekeysandplatemust not stack, so each keeps its metadata.Every item except the screwdriver is usable.
The inventory must store item metadata — without it, keys open nothing.
Where Players Get Them#
Item | Source |
|---|---|
| Hotwiring or robbing an NPC driver (while the config hands out keys), a key transfer from another player, the copy shop, the recovery NPC, |
| The copy shop sells both. Swapping a plate also hands back the old one as a plate item. |
| Not sold by the script — put them in a shop, a crafting bench or a job of your choosing. Keep the master key for staff. |



