From e42a878576e94498fc4680eeb405367bba2ab41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Kov=C3=A1=C4=8D?= Date: Sat, 22 Mar 2025 02:18:33 +0700 Subject: [PATCH] Fix multiple commands execution in adminmenu_custom.txt This PR fixes the semicolon parsing issue for adminmenu_custom.txt - player type cmd execution. Below is an example ```adminmenu_custom.txt``` to reproduce the semicolon ";" not working before this fix - multiple commands delimited with ";" will not work. ``` "Commands" { "ServerCommands" { "AntiCheat" { "admin" "sm_ban" "Enable KACR" { "cmd" "sm plugins load disabled/kigen-ac_redux; sm_chat KACR is enabled" "execute" "server" } } } } ``` --- plugins/adminmenu/dynamicmenu.sp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/plugins/adminmenu/dynamicmenu.sp b/plugins/adminmenu/dynamicmenu.sp index a534ef761e..354c7d2a6c 100644 --- a/plugins/adminmenu/dynamicmenu.sp +++ b/plugins/adminmenu/dynamicmenu.sp @@ -584,14 +584,22 @@ public void ParamCheck(int client) char unquotedCommand[CMD_LENGTH]; UnQuoteString(g_command[client], unquotedCommand, sizeof(unquotedCommand), "#@"); - if (outputItem.execute == Execute_Player) // assume 'player' type execute option - { - FakeClientCommand(client, unquotedCommand); - } - else // assume 'server' type execute option + // Use commands directly without unnecessary unquoting + char commands[10][CMD_LENGTH]; + int count = ExplodeString(g_command[client], ";", commands, sizeof(commands), sizeof(commands[])); + + for (int i = 0; i < count; i++) { - InsertServerCommand(unquotedCommand); - ServerExecute(); + TrimString(commands[i]); + if (outputItem.execute == Execute_Player) // assume 'player' type execute option + { + FakeClientCommand(client, commands[i]); + } + else // assume 'server' type execute option + { + InsertServerCommand(commands[i]); + ServerExecute(); + } } g_command[client][0] = '\0';