Troubleshooting

Fixes for Vehicle Keys setup problems, other scripts that call it, settings that clash, and changes that need a restart.

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

Find your symptom, then check the right-hand side. If nothing here fits, run /whatsloaded as an admin to see which framework, inventory and target Newb_Bridge picked, then ask in the Discord.

Install and start-up

SymptomCheck
Keyring is the context menuox_inventory started after this resource, or Key context menu is the chosen keyring style on the Keyring page
provide conflict on startAnother resource also provides qbx_vehiclekeys or kora_vehiclekeys. Remove it, or delete that provide line (see Requirements)
Shop will not sell a renamed itemThe locksmith price entry key has to be the real item name
Seed file edits do nothingThe database copy wins after the first boot. Change it in /setupkeys instead
Locker props deletedAllow the models on Anticheat models
Nothing responds for a moment after a restartThe key system starts about 2 seconds after the resource does. Give it a moment before you test
Keys phone app disappeared after restarting this resourceThe phone app depends on it and stops too. Start MrNewbVehicleKeysPhone again

Other scripts calling Vehicle Keys

These cover garages, dealerships, job scripts and anything else that gives, checks or removes keys.

SymptomCheck
Another script says it cannot find a keys exportVehicle Keys is not started yet, or it started after that script. Start it first, and guard calls with GetResourceState('MrNewbVehicleKeys') == 'started'
A script written for another key system does nothingOpen General > Other key scripts in /setupkeys, pick the script you are replacing and save. Its calls are only answered once you have done that
Calls meant for some other key system are ignoredOnly the key systems listed under Compatibility are answered. Check that script's switch on the Integrations page
Both the old script and this one react to the same eventStop the old key script. Two key systems answering the same events will conflict. Never provide a name whose original resource is still running
Server HasKeys always returns falseIt takes the player's server id and the vehicle's network id. To check by plate, call HasKeysByPlate
A client export only affects the local playerGiveKeys, RemoveKeys and the other client exports act on the player who runs them. For another player, call the server export
A key you gave from a script stops working after a whileTemp keys expire on a timer. Use the normal give-keys exports for keys that should stay
Keys do not follow a car after it is sold or its plate changesCall ClearSharedKeys (or RemoveAllKeys to take every key from online players, with the limits listed in the exports page), or trigger MrNewbVehicleKeys:Server:VehicleTransferred, when ownership changes, and TransferVehicleSecurity when a plate changes. See Server exports
A companion resource reports the keys API is too oldUpdate Vehicle Keys and the companion together. GetApiVersion tells you the level, currently 3
Your code relies on MrNewbVehicleKeys:Server:* or :Client:* events and breaks after an updateThose are internal and can change. Use the exports instead

Settings that clash

What you seeWhy it happens
Both this script and your HUD start the engine, or the engine key does nothingTwo scripts are answering the same key. Pick Another script does it under Starting the engine, or turn the HUD's engine toggle off. A HUD with its toggle already off does not count
Nobody can start a car with the engine keyThe engine key is switched off on the Keybinds page, but Press the engine key is still the chosen way to start
Give-a-key-if-the-engine-is-running and hotwire-gives-a-key do nothingKey must be inserted is on. Both are off while it is on, because a key that is not in the ignition cannot be handed over
The lock, unlock, start and roof options are missing from the eye menuThe same insert mode switch removes them. The key and the engine key do those jobs
Remote start stops working on a carIt has a keypad immobiliser fitted. A keypad lock turns remote start off
The fob buttons page does nothingFob style is set to Branded. Branded fobs follow the maker's layout, so fob buttons only apply to the Legacy fob
The Key types and Fob buttons pages are missingFob screen is off. Keys still work, but nothing appears on screen, and those pages are hidden
The Boat anchor page is missingBoat keys are turned off
Locksmith and key storages vanishedItem keys are off. Virtual keys cannot be cut or hung in a locker, so those switch off
The keyring bag is on, but the keyring still opens as a screenThe bag stays off while the keyring screen is on. Pick Keyring bag on the Keyring page
The . keybind or /keyring does nothing, or does not existOpen it with is set to Using the keyring item only, which is the default on item keys. Nothing is registered then. Switch it to Item, keybind and /keyring, or Keybind and /keyring only
The keyring key clashes with ox_inventoryF2 belongs to ox_inventory, so it is not used. Choose another key on the Keybinds page, or leave it unbound and use /keyring
A minigame never appearsIt was picked for the wrong action, or the other resource is not started. The built-in ones only work for their own action. Look for a yellow or red console line
A rule on a vehicle class has no effect on the serverThe server cannot read a car's class. Put the rule on a model, type or plate as well. See Per-vehicle rules
A job's car asks for a PIN, or cannot get a keypadCars shared with a job never ask its members for a PIN, and one cannot be fitted to them. The Skip the PIN in job vehicles switch changes this
Two /car commandsThe admin commands are on and qbx_core, or a HUD, still registers its own /car and /dv. Turn one off, or give ours a different name

Settings that need a restart

Almost everything in /setupkeys goes live for every player the moment you press Save. After a save, the panel lists the few that do not. These are the ones:

SettingWhat to do
ox_inventory featuresRestart MrNewbVehicleKeys. The hooks attach when the resource starts
Keyring bagTurning it on needs a restart of MrNewbVehicleKeys. The bag is registered with ox_inventory at start. Turning it off applies at once
/car and /dvTurning one on works straight away. Turning one off, or renaming it, needs a restart before FiveM lets go of the old name
New item namesThe items must already exist in your inventory. Restart the inventory after adding them
Renamed itemsThe old name keeps working until you restart MrNewbVehicleKeys
Keybind defaultsOnly players who have not rebound that key get the new default. Players who rebound it keep theirs
The keybind or command for the keyringAdding one applies at once. Taking it away needs a restart or a relog, because FiveM cannot unregister a key

Edits to the code files under resource/open/ always need a resource restart. They are listed under Needs a restart.

On this page