Revert "feat(es_extended/server/modules/commands.lua): Add Validation Number"

This commit is contained in:
Kenshin13
2025-03-04 14:06:50 +01:00
committed by GitHub
parent 5f340bae48
commit 22d191b51e
2 changed files with 7 additions and 13 deletions
@@ -1,5 +1,4 @@
local Inventory
local MAX_AMOUNT = 1.79769e+308
if Config.CustomInventory ~= "ox" then return end
@@ -46,7 +45,6 @@ Core.PlayerFunctionOverrides.OxInventory = {
setAccountMoney = function(self)
return function(accountName, money, reason)
reason = reason or "unknown"
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money < 0 then return end
local account = self.getAccount(accountName)
@@ -66,7 +64,6 @@ Core.PlayerFunctionOverrides.OxInventory = {
addAccountMoney = function(self)
return function(accountName, money, reason)
reason = reason or "unknown"
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money < 1 then return end
local account = self.getAccount(accountName)
@@ -85,7 +82,6 @@ Core.PlayerFunctionOverrides.OxInventory = {
removeAccountMoney = function(self)
return function(accountName, money, reason)
reason = reason or "unknown"
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money < 1 then return end
local account = self.getAccount(accountName)
+7 -9
View File
@@ -31,7 +31,6 @@
function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory, weight, job, loadout, name, coords, metadata)
---@class xPlayer
local self = {}
local MAX_AMOUNT = 1.79769e+308
self.accounts = accounts
self.coords = coords
@@ -314,7 +313,6 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
error(("Tried To Set Account ^5%s^1 For Player ^5%s^1 To An Invalid Number -> ^5%s^1"):format(accountName, self.playerId, money))
return
end
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money >= 0 then
local account = self.getAccount(accountName)
@@ -342,7 +340,6 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
error(("Tried To Set Account ^5%s^1 For Player ^5%s^1 To An Invalid Number -> ^5%s^1"):format(accountName, self.playerId, money))
return
end
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money > 0 then
local account = self.getAccount(accountName)
if account then
@@ -369,7 +366,6 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
error(("Tried To Set Account ^5%s^1 For Player ^5%s^1 To An Invalid Number -> ^5%s^1"):format(accountName, self.playerId, money))
return
end
money = money <= MAX_AMOUNT and money or MAX_AMOUNT
if money > 0 then
local account = self.getAccount(accountName)
@@ -408,12 +404,14 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
function self.addInventoryItem(itemName, count)
local item = self.getInventoryItem(itemName)
count += item.count
item.count = ESX.Math.Round(count) <= MAX_AMOUNT and ESX.Math.Round(count) or MAX_AMOUNT
self.weight += (item.weight * count)
if item then
count = ESX.Math.Round(count)
item.count = item.count + count
self.weight = self.weight + (item.weight * count)
TriggerEvent("esx:onAddInventoryItem", self.source, item.name, item.count)
self.triggerEvent("esx:addInventoryItem", item.name, item.count)
TriggerEvent("esx:onAddInventoryItem", self.source, item.name, item.count)
self.triggerEvent("esx:addInventoryItem", item.name, item.count)
end
end
---@param itemName string