Keys and fob

Key storage, the keyring, the key fob, throwing keys and the boat anchor.

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

Part of Configuration. Open /setupkeys to change these.

Key behaviour

These sit on the Keys & inventory page. Item based keys is the switch that makes every key a real inventory item (on) or an invisible list (off).

  • Use ox_inventory features (ox_inventory only): ox tells the script the moment a key is picked up or dropped. Off, the script checks the inventory every few seconds instead, which works with any inventory. Key check sets that interval and only applies when ox features are off
  • Aftermarket locks: the kit changes a car's lock code so old keys stop working. Who can install is owners only, or owners plus chosen jobs on any owned car, such as a customer's car at a shop. The chosen jobs can be limited to on duty
  • Save fob upgrades: fob upgrades on owned cars are saved to the database
  • Owner name on keys: the key description says who owns the car
  • Key pictures: each key shows its maker's picture. Copy the vehicle_key_*.png files, or turn this off (see Item images)

Keyring

Open the Keyring page. How players carry their keys has one card per style. Players carry one keyring item and you pick what it opens. You can change it at any time.

StyleWhat it is
Keyring screenA screen listing every key with a preview of each fob. Saved keys keep working without any item. Works on every inventory
Key context menuThe keyring item opens a small context menu to add, take out and hand over keys. No screen, and it works with every inventory
Keyring bagThe item opens like a bag, with the keys stored as items. Needs ox_inventory and Use ox_inventory features turned on. Keyring slots and Keyring weight set its size. Turning it on needs a resource restart

With virtual keys there is no item to choose, so players always use the keyring screen.

With the keyring screen you can also Open it with:

ChoiceOpens with
Item, keybind and /keyringThe keyring item, the keybind and /keyring
Using the keyring item onlyOnly the keyring item. /keyring and its keybind are not registered at all, so the keybind does not show under FiveM's key bindings or on the Keybinds page
Keybind and /keyring onlyOnly the keybind and /keyring. Using the keyring item tells the player to use the command instead

The default is Using the keyring item only, so out of the box there is no keyring command and no keybind. Switch to one of the other two to get them. On item keys, /keyring and its keybind also do not exist when the keyring screen is off. Adding the command or keybind applies straight away. Taking it away needs a resource restart or a relog, because FiveM cannot unregister a key.

The default keybind is . (PERIOD). F2 belongs to ox_inventory, so it is not used. Clear the keyring key on the Keybinds page to leave it unbound and keep /keyring only. Each key in the keybind list can also be switched off there. Players can still rebind it in FiveM settings, and a player's own binding is never overwritten by your default.

Sharing keys

Sharing keys (on by default) lets a car's owner give someone else access from the keyring screen and take it back. Share distance is how close the other player has to be, in metres, and Shares per vehicle is how many people one car can be shared with at once (0 means no limit).

  • With virtual keys the other player gets a saved virtual key straight away. It survives relogging and restarts until the owner revokes it or the car is sold
  • With item keys the other player gets the right to have a copy cut at a locksmith, not a key straight away

Sharing ends on its own when the owner no longer owns the car. Scripts that sell or transfer cars can end it at once with the ClearSharedKeys export or the vehicle transferred event, see Server exports.

Giving a temporary key

/givekeys hands the nearest player a temporary key for the closest car you hold a key for. It works with virtual keys and with item keys. The key is only kept in memory, so it lasts until the server restarts and nothing needs revoking. Only the owner, an admin, a member of a job that shares the car, or someone holding a real key can give one. Someone holding only a temporary key cannot pass it on. You and the other player must be within 10 meters of each other and the car.

The Give a temporary key card on the Keyring page of /setupkeys turns the command on or off. It is on by default.

Key fob

Fob style has two options:

  • Legacy: this script's own fob. It carries the extra buttons you set up.
  • Branded: the car maker's own fob (Karin, Pfister, Dinka and the rest). Every button works: lock, unlock, trunk, alarm and start. A car whose maker has no fob, and boats, fall back to the Legacy fob. The Fob buttons page does not apply to Branded keys, and locksmiths cannot add modules to them. At the locksmith bench, whoever cuts a key picks the brand.

The fob style also decides what players see in the keyring screen.

Fob buttons (Advanced) is a table of the extra buttons on smart keys: remote start, open doors, convertible roof, self park, summon, autopilot, dance mode, proximity locks and emergency lights. For each button:

ColumnMeaning
ShownThe button exists on keys and in the locksmith menu. Hidden means gone, even from keys that already list it
FreeAdded to every new smart key
SoldA locksmith can add it for the price
PriceDollars. Only for Sold buttons

With Sold on, an Advanced job picker restricts the button to the chosen jobs. With no jobs chosen, any job can use it.

Key types (Advanced) sets which style each car gets: smart, basic, luxury, boat or motorcycle. A model rule beats a class rule, and the default covers the rest. Hold to close up or open up (Advanced) makes a held lock or unlock button on the fob also close or open the windows, the roof and the doors.

Fob screen & range turns the on-screen remote on or off. With it off, keys still work but nothing appears. The lock range sets how far away the fob can still lock or unlock a car, up to 424 m, which is as far as OneSync keeps a car in view. Fob animation picks the animation and the prop players hold when they press a fob button.

Brand logos (Advanced) is where the maker's logo on each fob comes from. Search the list of makes, or scan the server for the makes you stream. For a make or model with no bundled logo, or to replace one, add an image link (an https link, for example from FiveManage) next to its make or model name. A model name beats its make, and Reset goes back to the bundled file.

Missing names (Advanced) finds cars that show a blank or NULL name and lets you give them one.

Throwing keys and the boat anchor

Throwing keys lets a player toss the key for the car they are sitting in out of the window, so someone else can pick it up. You set how long a thrown key stays on the ground and the command name. You can also change the model that flies out of the window and the animation a player plays when they pick the key up. The key to press is on the Keybinds page. How players reach it depends on the inventory: Commands lists the options.

Boat anchor (Advanced) lets players drop the anchor from the boat fob or with /anchor. You set how close the player has to be, in metres, and how slowly the boat must be moving. They do not have to be in the boat. The page is hidden while boat keys are off.

On this page