fix(package/addCommand): argument validation

Get the first index of raw.split for the command name.
Check if value is defined (as 0 is falsey).
Don't subscribe to 0-index propaganda (argument index+1).
This commit is contained in:
Linden
2024-01-15 18:52:28 +11:00
parent c383e42602
commit 2aa21e7478

View File

@@ -60,9 +60,9 @@ function parseArguments(
break;
}
if (!value && (!param.optional || (param.optional && arg))) {
if (value === undefined && (!param.optional || (param.optional && arg))) {
return Citizen.trace(
`^1command '${raw.split(' ') || raw}' received an invalid ${param.paramType} for argument ${index} (${
`^1command '${raw.split(' ')[0] || raw}' received an invalid ${param.paramType} for argument ${index + 1} (${
param.name
}), received '${arg}'^0`
);