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"
{
"PlayerCommands"
{
"Punishments"
{
"admin" "sm_ban"
"[BURN] TeamKill"
{
"cmd" "sm_burn #1; sm_psay #1 No TeamKill!"
"execute" "player"
"1" { "type" "player" "method" "name" "title" "Player:" }
}
}
}
}
This PR fixes the semicolon parsing issue for adminmenu_custom.txt - player type cmd execution.
Below is an example
adminmenu_custom.txtto reproduce the semicolon ";" not working before this fix - multiple commands delimited with ";" will not work."Commands" { "PlayerCommands" { "Punishments" { "admin" "sm_ban" "[BURN] TeamKill" { "cmd" "sm_burn #1; sm_psay #1 No TeamKill!" "execute" "player" "1" { "type" "player" "method" "name" "title" "Player:" } } } } }
I saw you have one too many sub-menu ( "[BURN] TeamKill") what usually breaks adminmenu_custom.
This is working one
"Commands"
{
"PlayerCommands"
{
"Punishments"
{
"admin" "sm_ban"
"cmd" "say sm_burn #1; say sm_psay #1 No TeamKill!"
"execute" "player"
"1"
{
"type" "player"
"method" "name"
"title" "Player:"
}
}
}
}
"Commands"
{
"PlayerCommands"
{
"Punishments"
{
"admin" "sm_ban"
"cmd" "say sm_burn #1; say sm_psay #1 No TeamKill!"
"execute" "player"
"1"
{
"type" "player"
"method" "name"
"title" "Player:"
}
}
}
}
-
If the above config is used it prints both commands in one message - without my fix, it's not delimited:
-
If it's an "execute server" type of menu, it doesn't need my proposed fix. It will delimit properly, e.g. this works:
"Commands"
{
"PlayerCommands"
{
"Punishments"
{
"admin" "sm_ban"
"cmd" "say sm_burn; say sm_psay No TeamKill!"
"execute" "server"
}
}
}
- I made a bad example. You are right - having a third level sub-menu or deeper breaks it (sub-menu won't open). That needs to be fixed, too. Thanks for pointing it out. Perhaps it's this error:
L 04/03/2025 - 12:10:58: [SM] Exception reported: Invalid Handle 0 (error: 4)
L 04/03/2025 - 12:10:58: [SM] Blaming: adminmenu.smx
L 04/03/2025 - 12:10:58: [SM] Call stack trace:
L 04/03/2025 - 12:10:58: [SM] [0] ArrayList.GetArray
L 04/03/2025 - 12:10:58: [SM] [1] Line 455, C:\Users\muso\Documents\srcds\lama-srcds\addons\sourcemod\scripting\adminmenu\dynamicmenu.sp::ParamCheck
L 04/03/2025 - 12:10:58: [SM] [2] Line 431, C:\Users\muso\Documents\srcds\lama-srcds\addons\sourcemod\scripting\adminmenu\dynamicmenu.sp::DynamicMenuItemHandler
...adminmenu_custom originally have not support more than one sub-menus.
You can trick 2nd sub menu by creating list of commands and rename them. Here is bot commands: https://forums.alliedmods.net/showpost.php?p=1628970&postcount=3
The depth of menus is another issue that's not covered by this fix. One children sub-menu limitation is not a big deal.
I would like my current approach reviewed as it fixes multiple player commands already. If it needs proper fix - suggestions are more than welcome. 🙏
I love the simplicity of your solution, it's suitable for me, however quoting adds another layer of safety, which would be broken by this.