mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 00:01:20 +00:00
add a new argument on the register command feature
This commit is contained in:
@@ -146,6 +146,14 @@ function ESX.RegisterCommand(name, group, cb, allowConsole, suggestion)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if v.isValid and not error then
|
||||
local candidate = newArgs[v.name]
|
||||
local ok, res = pcall(v.isValid, candidate)
|
||||
if not ok or res ~= true then
|
||||
error = v.error or TranslateCap("commanderror_argumentmismatch_" .. (v.name or tostring(k)), k)
|
||||
end
|
||||
end
|
||||
|
||||
--backwards compatibility
|
||||
if v.validate ~= nil and not v.validate then
|
||||
|
||||
@@ -313,7 +313,9 @@ if not Config.CustomInventory then
|
||||
arguments = {
|
||||
{ name = "playerId", help = TranslateCap("commandgeneric_playerid"), type = "player" },
|
||||
{ name = "item", help = TranslateCap("command_giveitem_item"), type = "item" },
|
||||
{ name = "count", help = TranslateCap("command_giveitem_count"), type = "number" },
|
||||
{ name = "count", help = TranslateCap("command_giveitem_count"), type = "number", isValid = function (countValue)
|
||||
return countValue > 0
|
||||
end },
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user