ozgaming
01-31-2012, 20:36
Using the basic menu from the help site, how would I run a command when you pick an answer. For example, if you picked yes it would then run command /pickyes or no would be /pickno. Just as an example.
public OnPluginStart()
{ RegConsoleCmd("panel_test1", Panel_Test1);
}
public PanelHandler1(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_Select)
{
PrintToConsole(param1, "You selected item: %d", param2);
} else if (action == MenuAction_Cancel) {
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
}
public Action:Panel_Test1(client, args)
{
new Handle:panel = CreatePanel();
SetPanelTitle(panel, "Do you like apples?");
DrawPanelItem(panel, "Yes");
DrawPanelItem(panel, "No");
SendPanelToClient(panel, client, PanelHandler1, 20);
CloseHandle(panel);
return Plugin_Handled;
}
public OnPluginStart()
{ RegConsoleCmd("panel_test1", Panel_Test1);
}
public PanelHandler1(Handle:menu, MenuAction:action, param1, param2)
{
if (action == MenuAction_Select)
{
PrintToConsole(param1, "You selected item: %d", param2);
} else if (action == MenuAction_Cancel) {
PrintToServer("Client %d's menu was cancelled. Reason: %d", param1, param2);
}
}
public Action:Panel_Test1(client, args)
{
new Handle:panel = CreatePanel();
SetPanelTitle(panel, "Do you like apples?");
DrawPanelItem(panel, "Yes");
DrawPanelItem(panel, "No");
SendPanelToClient(panel, client, PanelHandler1, 20);
CloseHandle(panel);
return Plugin_Handled;
}