Inventory Integration

Make sure your trunkitems and gloveboxitems database tables have at least 1 entry in them or your vehicle inventory will not update when plates are changed

Add the following item images to qb-inventory/html/images/ if not there already. Also located in mk_plates/images/

Locate function IsVehicleOwned inside of qb-inventory/server/main.lua and replace it with this.

local function IsVehicleOwned(plate)
    local result = MySQL.scalar.await('SELECT 1 from player_vehicles WHERE plate = ? OR fakeplate = ?', {plate, plate})
	return result
end

Locate local ownedItems = GetOwnedVehicleGloveboxItems(id) inside of qb-inventory/server/main.lua and replace the if statement underneath it to match this. There are 2 places you must do this replace. make sure you do both.

if IsVehicleOwned(id) and next(ownedItems) then
	secondInv.inventory = ownedItems
	Gloveboxes[id] = {}
	Gloveboxes[id].items = ownedItems
	Gloveboxes[id].isOpen = src
	Gloveboxes[id].label = secondInv.label
elseif Gloveboxes[id] and not Gloveboxes[id].isOpen then
	secondInv.inventory = Gloveboxes[id].items
	Gloveboxes[id].isOpen = src
	Gloveboxes[id].label = secondInv.label
else
	Gloveboxes[id] = {}
	Gloveboxes[id].items = {}
	Gloveboxes[id].isOpen = src
	Gloveboxes[id].label = secondInv.label
end

The statement should look like the above image. Make sure to make this edit in both places in this file or your glovebox items will not update properly.

Last updated