Skip to content

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

@Mart-User

Description

@Mart-User

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

Environment

  • Operating System version: Windows OS
  • Game/AppID (with version if applicable): L4D2
  • Current SourceMod version: 1.10.0.6499
  • Current MetaMod version: Source version 1.10.7-dev

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions