sh-vehiclekeys is currently in active development. The core feature set is stable and production-ready, but minor additions or adjustments may appear in future updates. Check the changelog in the resource folder after each update before restarting the resource on a live server.
Requirements
| Dependency | Purpose |
|---|---|
| QBCore | Player identity, job data, inventory, and notifications |
| mysql-async | Database persistence for shared key records |
| t3_lockpick | Lockpicking minigame item and logic |
sh-vehiclekeys in server.cfg.
Installation
Download and place the resource
Copy the
sh-vehiclekeys folder into your server’s resources directory.Import the SQL schema
Run the following statement against your server’s database. You can execute it directly in your database manager (e.g., phpMyAdmin, HeidiSQL) or add it to your automated SQL import process.
Configure shared/config.lua
Review and adjust the values described in the Configuration section below.
Default Keybinds
All keybinds are registered as GTA V input bindings and are fully remappable by each player in Settings → Key Bindings → FiveM.| Action | Default Key |
|---|---|
| Lock / Unlock nearby vehicle | L |
| Toggle engine on/off | G |
| Open keys management menu | (blank — player sets this in their FiveM settings) |
Configuration
shared/config.lua
Job-Shared Vehicles
Config.JobSharedVehicles lets you define a list of vehicle models that all players of a given job automatically hold keys to while on duty. This means your entire police department can drive any police-model vehicle without manually sharing keys — useful for departmental fleet management without giving out spawner access.
When a player’s active job is checked, the resource grants temporary in-memory keys to the listed models. These keys are not persisted to the database and do not appear in the player’s NUI key list.
Lockpicking
Lockpicking is handled by thet3_lockpick resource. Two items are supported: lockpick (4-pin difficulty) and advancedlockpick (3-pin difficulty). Both must be present in the player’s QBCore inventory to use. When a player attempts to pick a lock:
Minigame launches
The t3_lockpick minigame starts client-side. The
lockpick item uses 4 pins; the advancedlockpick uses 3 pins. Difficulty is fixed at level 2 — adjust it inside the t3_lockpick resource configuration if needed.Success or failure
On success, the vehicle is unlocked and the player receives persistent database keys if they are already seated in the driver’s seat. If they are outside the vehicle, it is simply unlocked without granting keys. On failure, the lock remains engaged and the pick item is consumed.
Keys NUI Menu
Open the keys management menu with your configured keybind (or via thekey_fob item when Config.UseKeyFob = true). The panel lists every vehicle in your QBCore garage and displays the following per vehicle:
Vehicle details shown in the NUI panel
Vehicle details shown in the NUI panel
- Make and model — derived from QBCore’s shared vehicle data
- Plate — the registered plate linked to the key record
- Insurance status — valid or uninsured
- Registration status — valid or expired
- Mileage — tracked distance driven (
traveldistancefield fromplayer_vehicles) - Parked status — whether the vehicle is currently stored (
state = 1) or out in the world
- Locate vehicle — sets a GPS waypoint to the vehicle’s current position if it is spawned in the world.
- Manage keys — opens a sub-panel listing every
citizenidthat holds a shared key grant for that vehicle, with the option to revoke individual grants.
Sharing and Revoking Keys
To give another player access to one of your vehicles, open the keys menu, select the vehicle, choose Give Keys, and enter the target player’s server ID. You can optionally assign a custom display name that appears in their key list.- Giving Keys
- Revoking Keys
- Open the keys menu with your keybind.
- Select the vehicle you want to share.
- Choose Give Keys and enter the target’s server ID.
- Optionally type a display name (e.g.,
"Mechanic — temp"). - Confirm. The key record is written to the
shvehiclekeystable immediately.
Key Fob Item (Optional)
WhenConfig.UseKeyFob = true, the keys menu can only be opened by using a key_fob item from the player’s inventory rather than a keybind. To enable this:
-
Add the
key_fobitem to your QBCoreitems.lua: -
Copy
sh_key_fob.pngfrom theINSTALL/folder into your inventory’shtml/images/directory (typicallyqb-inventory/html/images/). -
Set
Config.UseKeyFob = trueinshared/config.luaand restart the resource.