From 2aa21e747866e130d4a83798e1adc1f934f26bc5 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Mon, 15 Jan 2024 18:52:28 +1100 Subject: [PATCH] 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). --- package/server/resource/addCommand/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/server/resource/addCommand/index.ts b/package/server/resource/addCommand/index.ts index e96eb718e..239b08547 100644 --- a/package/server/resource/addCommand/index.ts +++ b/package/server/resource/addCommand/index.ts @@ -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` );