Hey Everyone,
Is it just me having issues with the HL2 DM Menu/Panel API under the latest Sourcemod or a known issue?
Menu/Panels are created ok, but fail to render on a clients screen.
This is under windows 10, running a local dedicated server
Update: Running the latest AMD drivers 22.11.2 incase it's a driver rendering issue, the menu code is working fine under other mods too.
The code is pretty much a direct copy from the Wiki, snippet below:
Code:
public void OnPluginStart()
{
RegConsoleCmd("sm_paneltest", Command_PanelTest);
RegConsoleCmd("sm_menutest", Command_MenuTest);
}
public Action Command_PanelTest(int iClient, int iArgs)
{
pPanelTest = new Panel();
pPanelTest.SetTitle("Panel Test:");
pPanelTest.DrawItem("Choice 1");
pPanelTest.DrawItem("Choice 2");
pPanelTest.Send(iClient, PanelTestHandler, 20);
delete pPanelTest;
return Plugin_Handled;
}
public int PanelTestHandler(Menu menu, MenuAction action, int param1, int param2)
{
if (action == MenuAction_Select) {
CReplyToCommand(param1, "You selected item: %d", param2);
} else if (action == MenuAction_Cancel) {
CReplyToCommand(param1, "Client %d's menu was cancelled. Reason: %d", param1, param2);
}
return 0;
}
public Action Command_MenuTest(int client, int args)
{
Menu menu = new Menu(Menu_Test_Handler);
menu.SetTitle("Do you like apples?");
menu.AddItem("yes", "Yes");
menu.AddItem("no", "No");
menu.ExitButton = false;
menu.Display(client, 20);
return Plugin_Handled;
}
public int Menu_Test_Handler(Menu menu, MenuAction action, int param1, int param2)
{
/* If an option was selected, tell the client about the item. */
if (action == MenuAction_Select)
{
char info[32];
bool found = menu.GetItem(param2, info, sizeof(info));
PrintToConsole(param1, "You selected item: %d (found? %d info: %s)", param2, found, info);
}
/* If the menu was cancelled, print a message to the server about it. */
else if (action == MenuAction_Cancel)
{
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
/* If the menu has ended, destroy it */
else if (action == MenuAction_End)
{
delete menu;
}
return 0;
}
Using:
SM Dev 1.12 - build 6972
MM : Source 1.12 - build 1165
__________________