Merge pull request #113 from overextended/fix/ox

fix(esx/player): improve accounts sync with ox inventory
This commit is contained in:
Mycroft
2022-02-18 19:14:19 +00:00
committed by GitHub
+3 -4
View File
@@ -196,13 +196,12 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
local account = self.getAccount(accountName)
if account then
local prevMoney = account.money
local newMoney = ESX.Math.Round(money)
account.money = newMoney
self.triggerEvent('esx:setAccountMoney', account)
if Inventory and (accountName == 'money' or accountName == 'black_money') then
if Inventory and Inventory.accounts[accountName] then
Inventory.SetItem(self.source, accountName, money)
end
end
@@ -219,7 +218,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
self.triggerEvent('esx:setAccountMoney', account)
if Inventory and (accountName == 'money' or accountName == 'black_money') then
if Inventory and Inventory.accounts[accountName] then
Inventory.AddItem(self.source, accountName, money)
end
end
@@ -236,7 +235,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
self.triggerEvent('esx:setAccountMoney', account)
if Inventory and (accountName == 'money' or accountName == 'black_money') then
if Inventory and Inventory.accounts[accountName] then
Inventory.RemoveItem(self.source, accountName, money)
end
end