Don't forget to remove qb-inventory folder (if you use it) from your resource folder before restarting your server after these changes
If you used core_inventory version 1.4.1 or greater, please jump to 2. Framework functions
Add or Replace functions by these functions in qb-core/server/player.lua
Note : All of these functions should be placed inside the CreatePlayer function
-- NOTE : This is a deprecated function, only work with qb-inventory by defaultfunctionself.Functions.GetItemBySlot(slot) slot =tonumber(slot)return self.PlayerData.items[slot]end
If using new qb add the last function as well
Note : This function should be placed inside the CreatePlayer function
Replace QBCore.Functions.HasItem in qb-core/client/functions.lua
functionQBCore.Functions.HasItem(items,amount)local isTable =type(items) =='table'local isArray = isTable and table.type(items) =='array' orfalselocal totalItems =#itemslocal count =0local kvIndex =2if isTable andnot isArray then totalItems =0for _ inpairs(items) do totalItems +=1end kvIndex =1endfor _, itemData inpairs(QBCore.Functions.GetPlayerData().items) doif isTable thenfor k, v inpairs(items) dolocal itemKV = {k, v} if itemData and itemData.name == itemKV[kvIndex] and ((amount and itemData.amount >= amount) and (not isArray and itemData.amount >=v) or (not amount and isArray)) then
count +=1endendif count == totalItems thenreturntrueendelse-- Single Items as String if itemData and itemData.name == items and (not amount or (itemData and amount and itemData.amount >= amount)) then
returntrueendendendend
In qb-core/shared/main.lua, in QBShared.StarterItems remove all item
3. Global configuration
Add the image of your items in core_inventory/html/img folder.
All your images should have the same name as your items. For example, if you have an item called sandwich_bacon, the image name should be sandwich_bacon.png.
Only .png image are include in the FXManifest so be sure to use this extension for your images
Add default items that are included in ITEMS.txt file in your qbcore/server/shared/items.lua file or use the file with default qb-core item in it. Categories for weapon items are already set and the size of the weapon too.
For all your weapons items in your items.lua file, addcategory='weapons'(don't forget the s at the end of weapons)
Please make sure you set weaponswith the s at the end
Add category to your attachmenst in items.lua too.
The attachment need a category (search 'component_' in core_inventory/config.lua to find all the attachments categories like category = 'component_suppressor' for example) and a componentHash (like componentHash='COMPONENT_AT_PI_SUPP_02').
The component hash list can be find here
for each items, configure the category, if you don't set category, the default apply by the script is misc
the stack property come from the category apply to the item. The default one apply is misc and the stack value is 2. If you want to increase / decrease this number, open core_inventory/config.lua and search for ItemCategories section. You can create a new category and then apply this category in your item.lua file with category = 'yourCategoryName'.
You can configure the ['x'] and ['y'] value for each item, x is the number column take by the item, y the number of row. The default value apply by the script is 1x1
For backpack item, you need to set the backpackModel (list can be find here) and the backpackTexture (default is 0 for each backpack model)
4. Money as item
in qbcore/config.lua, please make to modify moneytypes and dontAllowminus like this :
Make sure to have the item money and the item markedbills in your items.lua and for each one make sure to have the right category (money for moneyitem and markedbill for markedbills item) :