diff --git a/[core]/es_extended/server/bridge/inventory/oxinventory.lua b/[core]/es_extended/server/bridge/inventory/oxinventory.lua index b82b95f3..62b4c2af 100644 --- a/[core]/es_extended/server/bridge/inventory/oxinventory.lua +++ b/[core]/es_extended/server/bridge/inventory/oxinventory.lua @@ -1,4 +1,4 @@ -if Config.CustomInventory ~= "ox" then return end +if Config.CustomInventory ~= "ox" then return end MySQL.ready(function() TriggerEvent("__cfx_export_ox_inventory_Items", function(ref) @@ -12,14 +12,15 @@ MySQL.ready(function() end) end) -function ESX.GetItemLabel(item) +---@diagnostic disable-next-line: duplicate-set-field +ESX.GetItemLabel = function(item) item = exports.ox_inventory:Items(item) if item then return item.label end end -function setPlayerInventory(playerId, xPlayer, inventory, isNew) +function setPlayerInventory(playerId, xPlayer, inventory, isNew) exports.ox_inventory:setPlayerInventory(xPlayer, inventory) if isNew then local shared = json.decode(GetConvar("inventory:accounts", '["money"]')) @@ -32,4 +33,4 @@ function setPlayerInventory(playerId, xPlayer, inventory, isNew) end end end -end \ No newline at end of file +end diff --git a/[core]/es_extended/server/classes/overrides/oxinventory.lua b/[core]/es_extended/server/classes/overrides/oxinventory.lua index 49cf7b2d..c3be26a8 100644 --- a/[core]/es_extended/server/classes/overrides/oxinventory.lua +++ b/[core]/es_extended/server/classes/overrides/oxinventory.lua @@ -1,6 +1,6 @@ local Inventory -if Config.OxInventory ~= "ox" then end +if Config.CustomInventory ~= "ox" then return end AddEventHandler("ox_inventory:loadInventory", function(module) Inventory = module @@ -9,9 +9,9 @@ end) Core.PlayerFunctionOverrides.OxInventory = { getInventory = function(self) return function(minimal) - if not minimal then - return self.inventory - end + if not minimal then + return self.inventory + end local minimalInventory = {} @@ -45,10 +45,10 @@ Core.PlayerFunctionOverrides.OxInventory = { setAccountMoney = function(self) return function(accountName, money, reason) reason = reason or "unknown" - if money < 0 then return end + if money < 0 then return end local account = self.getAccount(accountName) - if not account then return end + if not account then return end money = account.round and ESX.Math.Round(money) or money self.accounts[account.index].money = money @@ -67,7 +67,7 @@ Core.PlayerFunctionOverrides.OxInventory = { if money < 1 then return end local account = self.getAccount(accountName) - if not account then return end + if not account then return end money = account.round and ESX.Math.Round(money) or money self.accounts[account.index].money = self.accounts[account.index].money + money @@ -82,10 +82,10 @@ Core.PlayerFunctionOverrides.OxInventory = { removeAccountMoney = function(self) return function(accountName, money, reason) reason = reason or "unknown" - if money < 1 then return end + if money < 1 then return end local account = self.getAccount(accountName) - if not account then return end + if not account then return end money = account.round and ESX.Math.Round(money) or money self.accounts[account.index].money = self.accounts[account.index].money - money @@ -204,7 +204,7 @@ Core.PlayerFunctionOverrides.OxInventory = { self.weight, self.maxWeight = weight, maxWeight self.inventory = items - if not money then return end + if not money then return end for accountName, amount in pairs(money) do local account = self.getAccount(accountName) diff --git a/[core]/es_extended/server/functions.lua b/[core]/es_extended/server/functions.lua index 635a4d53..617af16c 100644 --- a/[core]/es_extended/server/functions.lua +++ b/[core]/es_extended/server/functions.lua @@ -545,6 +545,7 @@ end ---@param item string ---@return string? +---@diagnostic disable-next-line: duplicate-set-field function ESX.GetItemLabel(item) if ESX.Items[item] then return ESX.Items[item].label @@ -609,6 +610,6 @@ function Core.IsPlayerAdmin(playerId) return true end - local xPlayer = ESX.Players[playerId] + local xPlayer = ESX.Players[playerId] return (xPlayer and Config.AdminGroups[xPlayer.group] and true) or false end