Item setup

Items for Vehicle Keys. Paste the matching file, then copy the PNGs.

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

Paste the matching file, then copy every PNG from [INSTALL]/images/ into your inventory images folder (Item images).

InventoryPaste intoImages
ox_inventoryox_inventory/data/items.lua from [INSTALL]/ox_inventory_items.txtox_inventory/web/images/
qb-coreqb-core/shared/items.lua from [INSTALL]/qb-core_items.txtqb-inventory/html/images/

Names have to stay as they are unless you also change them in /vehiclekeyssetup. If you rename blank_key in the items file and forget the locksmith shop, the shop stops selling it.

Players do not craft vehiclekeys. Garages, the locksmith, and admin commands hand them out. The script fills in the plate when it gives the key.

ItemWhat it is
vehiclekeysA key for one vehicle
keyringHolds several keys
lockpickOpens a locked door. Does not start the car
advancedlockpickSame idea, for cars that need the better pick
hotwire_kitOnly used if hotwiring requires an item
rental_paperworkThe paper that comes with a rental
aftermarket_locksOwner uses this to change the lock so old keys stop working
blank_keyUncut blank. Locksmiths burn one when they cut a key
keyfob_scannerSniffs a nearby fob and clones it onto a blank
ping_transmitterStick this on a car with the target option
ping_receiverUse it to ping cars you have a tracker on

On ox_inventory, vehiclekeys has two buttons. Throw Keys drops that key as a prop anyone can pick up. You have to be in a vehicle. Destroy Key deletes that one key. Spare copies you still have keep working. Thrown keys despawn after 30 minutes.

['vehiclekeys'] = {
    label = 'Vehicle Keys',
    weight = 50,
    stack = false,
    close = true,
    description = 'Keys for a vehicle',
    client = { image = 'vehiclekeys.png' },
    buttons = {
        {
            label = 'Throw Keys',
            action = function(slot)
                exports.MrNewbVehicleKeys:ThrowKeys(slot)
            end,
        },
        {
            label = 'Destroy Key',
            action = function(slot)
                exports.MrNewbVehicleKeys:DestroyKey(slot)
            end,
        },
    },
},

The full ox and QB lists are the two text files in [INSTALL].

A held key looks like this:

{
    plate = 'ABC1234',
    modelName = 'adder',
    keyType = 'smart', -- smart, luxury, basic, boat, motorcycle
    keyoptions = {},
}

lockid is set when aftermarket locks are on. hacked is set on scanner clones.