diff --git a/[core]/es_extended/server/modules/commands.lua b/[core]/es_extended/server/modules/commands.lua index 44cd4699..98c9fff6 100644 --- a/[core]/es_extended/server/modules/commands.lua +++ b/[core]/es_extended/server/modules/commands.lua @@ -307,6 +307,10 @@ if not Config.CustomInventory then "giveitem", "admin", function(xPlayer, args) + local MAX_AMOUNT = 1.79769e+308 + if args.amount > MAX_AMOUNT then + return showError(("Amount must be between 1 and %s"):format(MAX_AMOUNT)) + end args.playerId.addInventoryItem(args.item, args.count) if Config.AdminLogging then ESX.DiscordLogFields("UserActions", "Give Item /giveitem Triggered!", "pink", { @@ -334,9 +338,13 @@ if not Config.CustomInventory then "giveweapon", "admin", function(xPlayer, args, showError) + local MAX_AMOUNT = 1.79769e+308 if args.playerId.hasWeapon(args.weapon) then return showError(TranslateCap("command_giveweapon_hasalready")) end + if args.amount > MAX_AMOUNT then + return showError(("Amount must be between 1 and %s"):format(MAX_AMOUNT)) + end args.playerId.addWeapon(args.weapon, args.ammo) if Config.AdminLogging then ESX.DiscordLogFields("UserActions", "Give Weapon /giveweapon Triggered!", "pink", { @@ -364,9 +372,13 @@ if not Config.CustomInventory then "giveammo", "admin", function(xPlayer, args, showError) + local MAX_AMOUNT = 1.79769e+308 if not args.playerId.hasWeapon(args.weapon) then return showError(TranslateCap("command_giveammo_noweapon_found")) end + if args.amount > MAX_AMOUNT then + return showError(("Amount must be between 1 and %s"):format(MAX_AMOUNT)) + end args.playerId.addWeaponAmmo(args.weapon, args.ammo) if Config.AdminLogging then ESX.DiscordLogFields("UserActions", "Give Ammunition /giveammo Triggered!", "pink", {