πŸ’»QBCore

Locate "qb-core > server > player.lua"

Add Item

Find "AddItem" and replace with that

qb-core > server > player.lua
function self.Functions.AddItem(item, amount, slot, info)
	exports["ls-inventoryhud"]:AddItem(self.PlayerData.source, item, amount, info)
end
RemoveItem

Find "RemoveItem" and replace with that

qb-core > server > player.lua
    function self.Functions.RemoveItem(item, amount, id)
		local getItem = exports["ls-inventoryhud"]:GetItem(self.PlayerData.source, id)
		if getItem ~= nil then
			return exports["ls-inventoryhud"]:RemoveItem(self.PlayerData.source, id, amount)
		else
			local newItem = self.Functions.GetItemByName(item)
			if newItem ~= nil then
				return exports["ls-inventoryhud"]:RemoveItem(self.PlayerData.source, newItem._id, amount)
			end
		end
		return false
    end
GetItemByName

Find "GetItemByName" and replace with that

qb-core > server > player.lua
function self.Functions.GetItemByName(item)
	item = tostring(item):lower()
		
	for k ,v in pairs ( exports["ls-inventoryhud"]:GetItems(self.PlayerData.source) ) do
		if v._tpl == item then
			return v
		end
	end
end
GetItemsByName

Find "GetItemsByName" and replace with that

qb-core > server > player.lua
function self.Functions.GetItemsByName(item)
	item = tostring(item):lower()
	local items = {}
	for k ,v in pairs ( exports["ls-inventoryhud"]:GetItems(self.PlayerData.source) ) do
		if v._tpl == item then
			items[#items+1] = v
		end
	end
        return items
end

! IF YOUR VERSION NEWEST OF QB-CORE !

Locate "qb-core > server > player.lua" Find "QBCore.Player.CreatePlayer" Find "self.Functions = {}" and add this functions (!!YOU NEED TO ADD BOTTOM OF self.Functions IF YOU DONT YOU GET ERRORS!!),

NEW QBCORE CODE

qb-core HasItems

First we need to replace HasItem function in client side, "qb-core/client/functions.lua"

After the replace HasItem function in client side, locate "qb-core/server/events.lua", scroll the bottom and add this code snippet

Skin

Locate "qb-clothing > client > main.lua"

SaveSkin

Find "SaveSkin" and replace with that

Last updated