From 3833746a218720e234348ac81db1fbb009b3f41f Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Sat, 19 Feb 2022 03:30:42 +1100 Subject: [PATCH] fix(esx/player): improve accounts sync with ox inventory --- [esx]/es_extended/server/classes/player.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/[esx]/es_extended/server/classes/player.lua b/[esx]/es_extended/server/classes/player.lua index ed72e7f6..488acc07 100644 --- a/[esx]/es_extended/server/classes/player.lua +++ b/[esx]/es_extended/server/classes/player.lua @@ -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