alliedmodders / sourcemod

SourceMod - Source Engine Scripting and Administration
http://www.sourcemod.net/
978 stars 424 forks source link

MenuAction not firing on MenuHandler when a key is pressed on undraw [1-7] options #1385

Closed Mart-User closed 3 years ago

Mart-User commented 3 years ago

MenuAction not firing on MenuHandler when a key is pressed on undraw [1-7] options

Environment

Description

[L4D2] Basically when I display a menu through a sourcemod plugin and a user press a key from an undraw option, the menu closes, but the MenuHandler is not triggered. This also happens if the menu has pagination and a user selects next/back, but in this case I would suggest to return a new MenuAction.

Problematic Code

public void OnPluginStart()
{
    RegConsoleCmd("sm_testmenu", CmdTestMenu, "");
}

public Action CmdTestMenu(int client, int args)
{
    Menu menu = new Menu(HandleMenu);
    menu.SetTitle("Test");
    menu.AddItem("Test 1", "Test 1");
    menu.Display(client, MENU_TIME_FOREVER);
}

public int HandleMenu(Menu menu, MenuAction action, int client, int args)
{
    PrintToChatAll("action fired");
}

Steps to Reproduce

1) In-game type !testmenu in the chat. 2) Press the key "2". 3) No output to the chat.

Mart-User commented 3 years ago

sp file for testing

simplemenutest.sp.txt

asherkin commented 3 years ago

Thanks for the report - as discussed on Discord the SM code looks fine around here and attempts to explicitly handle the extra slots as cancellation events, so this'll need investigation to determine if it is a client-side issue with the menuselect commands.