QBESXStandalone
Agency-Vehiclekeys V2 Exports & API
Universal vehicle keys for FiveM on QBCore, Qbox, ESX or fully standalone.
v2.0.0Paid5 Pages

01Client Exports
| Export | Description |
|---|---|
HasKeys(plate) | True when the player holds a key for this plate: owner, shared or temporary. Job vehicles open by their model and are not counted here. |
GetKeys() | All keys of the player as a list of { plate, kind }. kind is owner, shared or temp. |
ToggleLock(vehicle) | Locks or unlocks a vehicle the player has a key for, with the same animation and checks as G. Without a vehicle the nearest one in range is used. |
ToggleEngine() | Starts or stops the engine of the vehicle the player drives, like U. |
OpenMenu() | Opens the key ring, for example from a radial menu or a phone app. |
CloseMenu() | Closes the key ring and gives the mouse back to the game. |
IsMenuOpen() | True while the key ring is open. |
useLockpick() | Starts a lockpick try at the car in front of the player, or hotwiring in the driver seat. Meant for ox_inventory items: client = { export = 'Agency-Vehiclekeys.useLockpick' }. |
02Server Exports
| Export | Description |
|---|---|
GiveKeys(source, plate, mode, hours) | Gives a key. mode 'temp' (default) is a temporary key, optionally for a number of hours, 'perm' a saved key. A source or an identifier works. |
RemoveKeys(source, plate) | Takes a shared or temporary key away again. Returns true when there was one. |
HasKeys(source, plate) | True when the player holds a key for the plate, job keys for a vehicle nearby included. |
SetOwner(source, plate) | Makes the player the owner of a plate, for garages and shops on standalone servers. A previous owner loses the key. |
RemoveOwner(plate) | Removes the owner this script saved for a plate. |
GetOwner(plate) | The identifier of the owner and where it comes from: 'framework' for owned vehicles of QBCore, Qbox or ESX, 'store' for owners saved by this script. |
GetKeyHolders(plate) | Everyone else with a key for the plate as a list of { identifier, kind, name, expires }. |
SetVehicleLocked(vehicle, locked) | Locks or unlocks a vehicle for everyone, without a key check. For scripts that need to open a car. |
IsVehicleLocked(vehicle) | True when the vehicle is locked. |
GetFramework() | The framework the script found: qbcore, esx or standalone. |
03Events
| Name | Side | Description |
|---|---|---|
Agency:Keys:GiveServer | Server | Asks for a temporary key for a plate, as Agency Garage and Agency Vehicleshop do. Trigger it from the client with the plate. The car has to be next to the player or be his. |
qb-vehiclekeys:server:AcquireVehicleKeys | Server | The key event of qb-vehiclekeys, understood the same way, so garages and shops made for qb-vehiclekeys keep working. |
vehiclekeys:client:SetOwner | Client | Client event many garages and shops fire after spawning a car. Leads to a temporary key for that plate after the same checks on the server. |
qb-vehiclekeys:client:AddKeys | Client | The client event of qb-vehiclekeys for handing out keys, understood the same way. |
simple_carkeys:client:toggleEngine | Client | Fired on the client when the engine is started or stopped with a key, so HUDs such as Agency-Hud can follow the engine state. |
+Good to know
Agency-Vehiclekeys V2 offers exports and understands the usual key events, so garages, shops, jobs and heist scripts can give, check and take keys.
- Giving and Checking Keys
- GiveKeys gives a temporary or saved key, RemoveKeys takes it away and HasKeys checks it, on the server with a source or an identifier and on the client for the player himself.
- Owners for Standalone Garages
- On standalone servers there is no framework table of owned vehicles. SetOwner makes a player the owner of a plate, RemoveOwner removes it and GetOwner reads it back.
- Events Other Scripts Use
- Agency:Keys:GiveServer, qb-vehiclekeys:server:AcquireVehicleKeys, vehiclekeys:client:SetOwner and qb-vehiclekeys:client:AddKeys all lead to a temporary key after the same checks: the car has to be next to the player or be his.
?Frequently asked questions
How do I give a key from my garage script?
On the server call exports['Agency-Vehiclekeys']:GiveKeys(source, plate) after the car was spawned, or fire TriggerServerEvent('Agency:Keys:GiveServer', plate) on the client. Scripts made for qb-vehiclekeys need no change.