feat (Shared): Added the ability to dynamically update the shared jobs, items and gangs.

This commit is contained in:
Idris
2022-02-13 20:45:49 +11:00
parent 6935e3481e
commit ae29c94a40
4 changed files with 85 additions and 0 deletions
+9
View File
@@ -549,6 +549,8 @@ end
QBCore.Player.LoadInventory = function(PlayerData)
PlayerData.items = {}
local inventory = MySQL.Sync.prepare('SELECT inventory FROM players WHERE citizenid = ?', { PlayerData.citizenid })
local missingItems = {}
if inventory then
inventory = json.decode(inventory)
if next(inventory) then
@@ -571,11 +573,18 @@ QBCore.Player.LoadInventory = function(PlayerData)
slot = item.slot,
combinable = itemInfo['combinable']
}
else
missingItems[#missingItems+1] = item.name:lower()
end
end
end
end
end
if #missingItems > 0 then
print(("%s the following items removed as they no longer exist: %s"):format(GetPlayerName(PlayerData.source), json.encode(missingItems)))
end
return PlayerData
end