View Single Post
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 05-15-2019 , 09:14   Re: How to get map names and add menu ?
Reply With Quote #4

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 0lengthi++)
    {
        array.
GetString(imapsizeof(map));
        
GetMapDisplayName(mapdisplayNamesizeof(displayName));
        
menu.AddItem(displayNamedisplayName);
    }

    
delete array;

    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
int Menu_Handler(Menu menuMenuAction actionint clientint param2)
{
    if (
action == MenuAction_Select)
    {
        
// Do stuff
    
} else if (action == MenuAction_End) {
        
delete menu;
    }

    return 
0;


Last edited by ThatKidWhoGames; 05-16-2019 at 11:42.
ThatKidWhoGames is offline