Closed Rudios123 closed 6 months ago
This has nothing to do with this script. the issue is do you use a old inventory or a new updated version? This is a issue in the inventory not this script :)
Do you have this local function local function SaveInventory(source, offline)
in your inventory server side file?
---Saves the inventory for the player with the provided source or PlayerData is they're offline
---@param source number | table Source of the player, if offline, then provide the PlayerData in this argument
---@param offline boolean Is the player offline or not, if true, it will expect a table in source
local function SaveInventory(source, offline)
local PlayerData
if not offline then
local Player = QBCore.Functions.GetPlayer(source)
if not Player then return end
PlayerData = Player.PlayerData
else
PlayerData = source -- for offline users, the playerdata gets sent over the source variable
end
local items = PlayerData.items
local ItemsJson = {}
if items and table.type(items) ~= 'empty' then
for slot, item in pairs(items) do
if items[slot] then
ItemsJson[#ItemsJson + 1] = {
name = item.name,
amount = item.amount,
info = item.info,
type = item.type,
slot = slot,
}
end
end
MySQL.prepare('UPDATE players SET inventory = ? WHERE citizenid = ?', { json.encode(ItemsJson), PlayerData.citizenid })
else
MySQL.prepare('UPDATE players SET inventory = ? WHERE citizenid = ?', { '[]', PlayerData.citizenid })
end
end
exports('SaveInventory', SaveInventory)
if not you have a old qb-inventory script and you need to update.
After installation, I enter the server, but when I select a character, I keep seeing a black screen.