PHP Code:
void CreateMapMenu(int client)
{
ArrayList array = new ArrayList(ByteCountToCells(64));
ReadMapList(array);
int length = array.Length;
if (!length)
{
delete array;
return;
}
Menu menu = new Menu(Menu_Handler);
menu.SetTitle("Map Menu\n ");
char map[64], displayName[64];
for (int i = 0; i < length; i++)
{
array.GetString(i, map, sizeof(map));
GetMapDisplayName(map, displayName, sizeof(displayName));
menu.AddItem(displayName, displayName);
}
delete array;
menu.Display(client, MENU_TIME_FOREVER);
}
public int Menu_Handler(Menu menu, MenuAction action, int client, int param2)
{
if (action == MenuAction_Select)
{
// Do stuff
} else if (action == MenuAction_End) {
delete menu;
}
return 0;
}