Skip to main content

QBCore / Qbox

Missing qb-vehiclekeys export​

Carlock retains vehiclekeys:client:SetOwner and selected Qbox compatibility handlers, but does not export every function under the qb-vehiclekeys resource name. A resource still calling exports['qb-vehiclekeys']:HasKeys() can therefore fail after you disable the old key system.

Inspect the actual caller rather than replacing an entire framework event with an old snippet. For a client possession check with an available vehicle entity:

local hasKey = vehicle ~= 0 and DoesEntityExist(vehicle)
and exports.wasabi_carlock:HasKey(GetVehicleNumberPlateText(vehicle))
or false

Do not replace the check with unconditional true. HasKey awaits a server response, so place it in an appropriate yielding context rather than a per-frame loop.

Purchases, garages, and job spawners​

The retained client event queues a validated grant:

TriggerEvent('vehiclekeys:client:SetOwner', plate)

It does not authorize any arbitrary plate or guarantee immediate delivery. Set the vehicle's final plate and satisfy ownership/network/range checks. For server-authorized spawns or purchases, use:

-- In your already-authorized server purchase/spawn flow:
local success, reason = exports.wasabi_carlock:GiveKeys(
playerId, GetVehicleNumberPlateText(vehicle), GetEntityModel(vehicle)
)

Only grant after your resource has validated the transaction and recipient. Do not add an unrestricted grant network event to work around a rejected client request.

Qbox compatibility​

The current compatibility surface includes:

  • Client qbx_vehiclekeys:HasKeys(vehicle) — local possession check using the entity's plate.
  • Server qbx_vehiclekeys:GiveKeys(target, vehicle) — trusted grant using the entity's plate/model.

Other functions are not implied by those handlers. Prefer Carlock's own Exports for new integrations, and do not keep the old key resource active alongside Carlock just to satisfy an unrelated export call.

Inventory setup​

QB and PS item definitions belong in qb-core/shared/items.lua; keys/fobs use unique = true and useable = true. Follow the provider-specific metadata display instructions in _invItems/data.lua and copy its images. Qbox with Ox Inventory uses the Ox item block instead, including consume = 0 and the key-use server export.

Ownership and permissions​

QB/QBX ownership lookups use player_vehicles.citizenid and plate. Verify your vehicle shop/garage writes compatible ownership data. The admin command checks configured framework permissions (admin/god by default), not the player's job name. NPC assistance and ignition bypass are separate job-based features.