manniche_radial and can change before the release.Who can lock
The client sends only the vehicle's network ID. The server checks the rest and sets the lock. A player can lock when one of these is true:
- They own the vehicle in the framework database:
owned_vehicleson ESX (owner, or job withjobVehicles),player_vehicleson QBCore and Qbox. This needsoxmysqlstarted. - The state bag
owneron the vehicle matches the player, but only whensv_stateBagStrictModeistrue. - The owner gave them keys with the key command. Given keys last until the server restarts.
- A supported keys script reports that they have keys.
Config.vehicle.driverCanLockis true and they sit in the driver seat.
Ownership lookups are cached for 30 seconds. A player can send a lock request at most every 500 ms. The player must sit in the vehicle or be within lockDistance plus a margin of 3.0 metres.
On a standalone server there is no database ownership. Only given keys, a keys script or driverCanLock allow locking.
Keys
The owner uses /givekey <id> and /removekey <id> next to or in the vehicle. Only the owner can do this. Giving keys also needs the target within giveKeyDistance. Command names come from the config.
Supported keys scripts
With Config.vehicle.keys = 'auto' the first started script in this order is asked:
qbx_vehiclekeysRenewed-Vehiclekeyswasabi_carlockvehicles_keysMrNewbVehicleKeysqb-vehiclekeysp_vehiclekeys
Set keys to one of these names to ask only that one, or 'none' to ask none. When qbx_vehiclekeys is started, the lock state is also set through its SetLockState. When p_vehiclekeys is started, the lock is set through its changeLockState, which also flashes the lights.
For any other keys script, set Config.vehicle.lockEvent to a client event that toggles the lock.