AI Core

ai-vehiclekeys

Vehicle keys, locking with a key fob, lockpicking and hotwiring, and the engine block without a key.

ai-vehiclekeys decides who may lock, unlock and start a vehicle. A player without the key cannot start the engine; with a lockpick they can try to open a locked door or hotwire the car.

What it does in the game

  • Who has a key. The owner of an owned vehicle always has its key, and every member of the job or gang that owns a fleet vehicle has it too. These keys are never stored: they follow ownership in ai-vehicles, so selling a car moves the key with it. Other scripts can give extra keys (a rental, a job vehicle, a test drive, an admin spawn); those last until the player leaves the server or switches character.
  • Locking. Press U near a vehicle you have the key to. The lights flash and the horn beeps once when you are on foot.
  • Engine. In the driver seat without a key, the engine stays off: the player cannot start it by accelerating, and the radial menu's engine item refuses too. M switches the engine off and on again for a driver who has the key.
  • Handing over keys. Sitting in a vehicle you hold the key of, the radial menu's vehicle section shows Hand over the keys. The nearest other player within 3 m gets a copy (you keep yours). Both get a notification.
  • Lockpicking. Use a lockpick item next to a locked vehicle (within 3 m) to open its doors. Use it in the driver seat of a vehicle you have no key to, to hotwire it: on success the player holds the key until leaving the server. The order is: the minigame (if one is set), a progress bar, then the chance roll. The player must stay within 4 m of the vehicle until the end. A failed try may break the lockpick.

Installation

Installed by the AI Core recipe. By hand: ensure ai-vehiclekeys after ai-core and ai-vehicles. Add a lockpick item to your inventory if it has none: ai-vehiclekeys registers it as usable with whichever inventory runs.

In the admin panel, Server > General > Key script picks the key system. Automatic uses ai-vehiclekeys when no other supported key script runs.

Panel settings

Admin panel > Vehicle keys > tab Keys and locks. Defaults come from data/settings.json.

Lock key

SettingWhat it changesUnitDefault
Lock reachHow close the player must be to the vehicle to lock or unlock it. 2-30.m6

Lockpicking

SettingWhat it changesUnitDefault
Door chanceChance a lockpick opens a locked door. 0-100.%60
Door timeHow long the progress bar for a door runs. 1-60.s5
Hotwire chanceChance the engine starts; the player then has the keys until leaving the server. 0-100.%35
Hotwire timeHow long the progress bar for hotwiring runs. 1-120.s10
Break chanceChance the lockpick breaks when a try fails. 0-100.%25
MinigamePlayed before the progress bar: None, Skill check or Lockpick. A lockpick that breaks in the lockpick game is used up. The chance above is still rolled after a won game: set it to 100 % to let the game decide alone.Lockpick
DifficultyEasy, Medium or Hard. Shown only when a minigame is picked.Medium

Commands

None.

Keybinds

Each player can change these in GTA's key settings (FiveM section); the owner changes the defaults in the admin panel (Keybinds).

Default keyWhat it does
ULock or unlock the nearest vehicle you have the key to.
MEngine on / off (driver seat only). Without a key it shows "You do not have the keys to this vehicle".

What it stands in for

fxProvide: qbx_vehiclekeys. exports.qbx_vehiclekeys:HasKeys, GiveKeys, RemoveKeys, SetLockState and IsPlayerNearVehicle reach ai-vehiclekeys.

Other key scripts

You can run another key script instead: AI Core's key layer talks to qbx_vehiclekeys, qb-vehiclekeys, wasabi_carlock, Renewed-Vehiclekeys, MrNewbVehicleKeys, vehicles_keys (Jaksam), mVehicle, cd_garage's keys and tgiann-hotwire. Pick it in the admin panel (Server > General > Key script) and stop ai-vehiclekeys. Every ai-* script gives keys through the layer, so they keep working.

Known limits

  • Extra keys (hotwired, handed over, given by scripts) last only for the session: they are gone when the player leaves or switches character.
  • Lockpicking needs the lockpick item to exist in your inventory's item list.

On this page