diff --git a/server/player.lua b/server/player.lua index 81b7d11..b471784 100644 --- a/server/player.lua +++ b/server/player.lua @@ -485,35 +485,35 @@ end QBCore.Player.LoadInventory = function(PlayerData) PlayerData.items = {} - QBCore.Functions.ExecuteSql(true, "SELECT * FROM `players` WHERE `citizenid` = '"..PlayerData.citizenid.."'", function(result) - if result[1] ~= nil then - if result[1].inventory ~= nil then - plyInventory = json.decode(result[1].inventory) - if next(plyInventory) ~= nil then - for _, item in pairs(plyInventory) do - if item ~= nil then - local itemInfo = QBCore.Shared.Items[item.name:lower()] - PlayerData.items[item.slot] = { - name = itemInfo["name"], - amount = item.amount, - info = item.info ~= nil and item.info or "", - label = itemInfo["label"], - description = itemInfo["description"] ~= nil and itemInfo["description"] or "", - weight = itemInfo["weight"], - type = itemInfo["type"], - unique = itemInfo["unique"], - useable = itemInfo["useable"], - image = itemInfo["image"], - shouldClose = itemInfo["shouldClose"], - slot = item.slot, - combinable = itemInfo["combinable"] - } - end + QBCore.Functions.ExecuteSql(true, "SELECT * FROM `players` WHERE `citizenid` = '"..PlayerData.citizenid.."'", function(result) + if result[1] ~= nil then + if result[1].inventory ~= nil then + plyInventory = json.decode(result[1].inventory) + if next(plyInventory) ~= nil then + for _, item in pairs(plyInventory) do + if item ~= nil then + local itemInfo = QBCore.Shared.Items[item.name:lower()] + PlayerData.items[item.slot] = { + name = itemInfo["name"], + amount = item.amount, + info = item.info ~= nil and item.info or "", + label = itemInfo["label"], + description = itemInfo["description"] ~= nil and itemInfo["description"] or "", + weight = itemInfo["weight"], + type = itemInfo["type"], + unique = itemInfo["unique"], + useable = itemInfo["useable"], + image = itemInfo["image"], + shouldClose = itemInfo["shouldClose"], + slot = item.slot, + combinable = itemInfo["combinable"] + } end end end end - end) + end + end) return PlayerData end