QB
FRAMEWORK CONFIGURATION
Choose your framework version. Complete the neccicerry changes and continue at BASICS to finalize installation.
(NEW) FOR QB-CORE HIGHER OR EQUAL TO 1.3.0
This is the simplest and most recommended installation for the newest qb-core version. Basically plug and play
START ORDER
ensure mysql-async
ensure framework -- your framework qbcore, es_extended, qbox
ensure PolyZone -- Required if any of your scripts use it
ensure core_focus -- Here you place core_focus if you use it
ensure qb-target
ensure ox_target
ensure core_inventory -- Here you start core_inventory
...FOR QB-CORE FROM 1.0 to 1.3 REPLACE THESE FUNCTIONS
Replace QBCore.Functions.HasItem in qb-core/server/functions.lua
function QBCore.Functions.HasItem(source, items, amount)
if GetResourceState('core_inventory') == 'missing' then return end
return exports['core_inventory']:hasItem(source, items, amount)
endReplace QBCore.Functions.HasItem in qb-core/client/functions.lua
function QBCore.Functions.HasItem(items, amount)
if GetResourceState('core_inventory') == 'missing' then return end
return exports['core_inventory']:hasItem(items, amount)
endFOR QB-CORE FROM 1.0 to 1.1 ADD THESE FUNCTIONS
Dont forget to replace functions above also if your framework is in this range
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
function self.Functions.AddItem(item, amount, slot, metadata, inventory)
inventory = inventory or 'content-' .. self.PlayerData.citizenid
amount = amount or 1
return exports['core_inventory']:addItem(inventory, item, tonumber(amount), metadata)
endfunction self.Functions.RemoveItem(item, amount, slot, inventory)
inventory = inventory or 'content-' .. self.PlayerData.citizenid
amount = amount or 1
return exports['core_inventory']:removeItem(inventory, item, tonumber(amount))
endfunction self.Functions.ClearInventory(inventory)
inventory = 'content-' .. self.PlayerData.citizenid
return exports['core_inventory']:clearInventory(inventory)
endfunction self.Functions.GetItemByName(item, inventory)
inventory = inventory or 'content-' .. self.PlayerData.citizenid
return exports['core_inventory']:getItem(inventory, item)
endfunction self.Functions.GetItemsByName(item, inventory)
inventory = inventory or 'content-' .. self.PlayerData.citizenid
return exports['core_inventory']:getItems(inventory, item)
end-- NOTE : This is a deprecated function, only work with qb-inventory by default
function self.Functions.GetItemBySlot(slot)
slot = tonumber(slot)
return self.PlayerData.items[slot]
end function self.Functions.SetInventory(items, dontUpdateChat)
self.PlayerData.items = items
self.Functions.UpdatePlayerData(dontUpdateChat)
TriggerEvent('qb-log:server:CreateLog', 'playerinventory', 'SetInventory', 'blue', '**' .. GetPlayerName(self.PlayerData.source) .. ' (citizenid: ' .. self.PlayerData.citizenid .. ' | id: ' .. self.PlayerData.source .. ')** items set: ' .. json.encode(items))
endBASICS
CONFLICTING SCRIPTS
Remove qb-weapons or any other ammunition system from your server. Core Inventory provides its own advanced version
Remove qb-shops or any other shop script. Core Inventory provides its own shopping experience in
core_inventory/config_shops.luafile.
IMAGES
Add the image of your items in
core_inventory/html/imgfolder.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
ITEMS
Add default items from [items] folder.
In
qb-core/shared/main.lua, in QBShared.StarterItems remove all items. Use StartItems incore_inventory/config.luaFor all your weapons items in your
qb-core/shared/items.luafile, add["category"] = 'weapons'. Or even better, you can use theweapons.luawe provide in [items] folder. All weapons have a size and the right category already set on it.Open
config_weapon.luaand choose your attachment component mode, then add the attachment items in yourqb-core/shared/items.luarelated to the mode you choose.For every other item in your
qb-core/shared/items.luaset a category parameter["category"] = (your category). This will change its color, sound, stacking properties in inventory. If not set will default to misc category.Setup every added category in
core_inventory/config.luaunderItemCategories = {. Make sure to read the variables and what they do in configSetup item sizes in
qb-core/shared/items.luaby defining x and y parameters.["x"] = 2, ["y"] = 2. The x defines how many slots the items takes up horizontally and the y vertically.For more item information checkout ITEMS
MONEY AS ITEM
in qbcore/config.lua, please make to modify moneytypes and dontAllowminus like this :
QBConfig.Money.MoneyTypes = { cash = 500, bank = 5000, crypto = 0, black_money = 0 }
QBConfig.Money.DontAllowMinus = { 'cash', 'crypto', 'black_money' } In core_inventory/config.lua make sure to enable the money as item option and set the right account name in the option, for example :
MoneyAsItem = true, -- enable / disable money as item
AccountMoneyAsItem = 'cash', -- account name
ItemMoneyAsItem = 'money', -- item name
DirtyMoneyAsItem = true, -- enable / disable balck money as item
AccountDirtyMoneyAsItem = 'black_money', -- account name
ItemDirtyMoneyAsItem = 'markedbills', -- item nameMake 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) :
money = { name = 'money', label = 'Money', category = 'money', weight = 1000, type = 'item', image = 'cash.png', unique = true, useable = false, shouldClose = true, description = 'Money' },
markedbills = { name = 'markedbills', category = 'markedbill', label = 'Marked Money', weight = 1000, type = 'item', image = 'markedbills.png', unique = true, useable = false, shouldClose = true, description = 'Money?' },Last updated