QB Inventory

Creating the Items

Go to qb-core/shared/items.lua, COPY and PASTE this items:

New qb-core:

-- mg-jerrycan
    mg_jerrycan                    = { name = 'mg_jerrycan', label = 'Jerrycan 20L', weight = 20000, type = 'item', image = 'mg_jerrycan.png', unique = true, useable = true, shouldClose = true, description = 'A can full of Fuel' },
    empty_jerrycan                    = { name = 'empty_jerrycan', label = 'Empty Jerrycan', weight = 1000, type = 'item', image = 'empty_jerrycan.png', unique = false, useable = true, shouldClose = true, description = 'An empty jerrycan' },

Old qb-core:

-- mg-jerrycan
    ["mg_jerrycan"] = {["name"] = "mg_jerrycan",["label"] = "Jerrycan 20L",["weight"] = 20000,["type"] = "item",["image"] = "mg_jerrycan.png",["unique"] = true,["useable"] = true,["shouldClose"] = true,["combinable"] = nil,["description"] = "A can full of Fuel."},
    ["empty_jerrycan"] = {["name"] = "empty_jerrycan",["label"] = "Empty Jerrycan",["weight"] = 1000,["type"] = "item",["image"] = "empty_jerrycan.png",["unique"] = false,["useable"] = true,["shouldClose"] = true,["combinable"] = nil,["description"] = "An empty jerrycan."},

Creating the Metadata

You must add the following line in qb-inventory/html/js/app.js.

} else if (itemData.name == "mg_jerrycan") {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html(
        "<p><strong>Fuel: </strong><span>" +
        itemData.info.fuel +
        "</span></p>"
    );

Default Item Metadata

Go to qb-inventory/server/commands.lua and to give you the jerrycan item with metadata you have to modify your giveitem command.

Add this inside the giveitem command, arround line 19:

elseif itemData['name'] == 'mg_jerrycan' then
	info.fuel = 20 -- Or what fuel you want

Last updated