Configuration

Vehicle Keys settings live in /vehiclekeyssetup.

In-development version. These docs cover the testing build of VehicleKeys. The official release is still documented on the GitBook linked in its README.

Run /vehiclekeyssetup as an admin. Changes are saved and pushed to connected players without a restart.

A few files stay editable because they hold code. A change there needs a resource restart:

FileWhat you edit
resource/open/shared/hooks.luaValidation checks (return false to block lock, hotwire, search, lockpick, or engine start) and the key fob buttons
resource/open/shared/minigames.luaThird-party minigame wiring
resource/open/server/open_hooks.luaLogVehicleKeysAction(src, action, data)
resource/open/server/dispatch.luaPolice alert
resource/open/client/integrations.luaLockpick item integration

What to set first

SettingDefaultWhat it does
InventoryKeys.EnabledonOn = keys are inventory items. Off = virtual keys, opened with F2. Switch this before launch
InventoryKeys.OxInventory.ContainerKeyringon, 10 slotsKeyring is a real ox_inventory container. Off = the old menu keyring
InventoryKeys.EnableAftermarketLocksonOwners can change a lock so old keys stop working
Driving.InsertMode.EnabledoffKey has to go in the ignition (I) before the engine starts. Turns off give-key-if-running and hotwire-gives-a-key while it is on
Driving.EngineToggleEnabledon, unless a known HUD runsEngine key. Starts off when jg-hud, ps-hud, qb-hud, or qbx_hud is running
ProximityLockingonAuto lock and unlock as the owner walks away or back
LockVehicleRange / KeyFobLockRange15 / 150 mL key, and the on-screen fob
Hotwireon, 3 attemptsItem.Required makes hotwire_kit mandatory
LockpicksonOpens a locked door. Does not start the car
SearchForKeysonSearch a car for left-in keys
CarjackingonPulls the driver out at weapon point
DispatchonAlerts for hotwire, lockpick, and hijacking. Chances are 0–100
LocksmithNPConWalk-up ped. Hides while a player locksmith is online
LocksmithJobonPlayer locksmith. Factory job name is police so you can test. Set the real job on each location
KeyJobStorages2 police lockersCabinets where a job hangs spare keys
AdminCommandsoffTurns on /car and /dv
CompatibilityEventsqb and qbx onWhich foreign key events this resource answers
DebugModeoffVerbose logging and the debug commands

Per-vehicle rules

Each field falls back one tier at a time:

plates -> models -> classes -> types -> default

An entry only names the fields it changes. Chances are 0.0 to 1.0 (dispatch alert chances are 0 to 100).

FieldMeaning
neverNeedsKeyNever needs or receives a key
cannotBeStolenBlocks hotwire, carjack, search, and lockpick
cannotBeLockpickedBlocks lockpicking only
needsAdvancedLockpickNormal lockpick blocked
cannotBeCarjackedBlocks carjacking only
chanceLockedWhenParkedChance an empty unowned vehicle is locked
chanceLockedWhenNpcDrivingChance an NPC-driven vehicle is locked
chanceSearchFindsKeysChance a search turns up the keys
chanceLockpickBreaks / chanceAdvancedLockpickBreaksChance that pick breaks
hotwireDifficulty / lockpickDifficulty / advancedLockpickDifficulty / keyCuttingDifficulty'easy', 'medium', 'hard', or false to block it
frontTrunkDoorIndexRear-engine cars whose trunk is at the front

plates is exact plate text. models is a hash or spawn name. types is automobile, bike, boat, heli, plane, submarine, trailer, train. Pedal bikes report as bike, so list those by model. Server-enforced fields have to live on models, types, plates, or on a class that also has a models list. The server warns at start if a class is missing that list, or a chance is outside 0.0–1.0.

Shared job vehicles

Employees share keys to that job’s vehicles. requireOnDuty counts only while clocked in. enableAutolock locks the car behind the last driver. Prefer models and plates. A classes entry only matches on the server when that class also has a models list.

Locksmith and tracker

The walk-up ped sells spare keys, fob upgrades, and the items under its price list. The entry key has to be the real item name.

The player job has a bench, register, stash, and computer. The bench burns one blank_key per cut when that is required. Item-key mode has to be on for the bench and the keyfob_scanner. The scanner sniffs a nearby fob and clones it onto a blank. Key lockers are stored in SQL. Renaming a location key creates a new empty locker.

ping_transmitter sticks on a car from the target option. ping_receiver pings a blurred blip. Tracker state is in memory, so it clears on a server restart, and the ping only works while that vehicle is spawned.

Compatibility

CompatibilityEvents chooses which foreign events and legacy exports answer. Garage entries switch on when that garage resource is running. provide lines in fxmanifest.lua let exports['qbx_vehiclekeys']:GiveKeys(...) resolve here. Only provide 'qbx_vehiclekeys' is active in the shipped manifest.

MrNewbVehicleKeys:Client:* and MrNewbVehicleKeys:Server:* are internal. Do not build on them.

On this page