Merge pull request #1009 from thelindat/patch-2

fix(esx/ox_inventory): trigger esx:setAccountMoney when syncing inventory
This commit is contained in:
Csoki
2023-04-19 15:48:13 +02:00
committed by GitHub
@@ -208,14 +208,16 @@ Core.PlayerFunctionOverrides.OxInventory = {
self.inventory = items
if money then
for k, v in pairs(money) do
local account = self.getAccount(k)
if ESX.Math.Round(account.money) ~= v then
account.money = v
for accountName, amount in pairs(money) do
local account = self.getAccount(accountName)
if account and ESX.Math.Round(account.money) ~= amount then
account.money = amount
self.triggerEvent('esx:setAccountMoney', account)
TriggerEvent('esx:setAccountMoney', self.source, accountName, amount, 'Sync account with item')
end
end
end
end
end
}
}