View Single Post
MaNaReaver
Member
Join Date: Apr 2020
Location: India
Old 07-01-2020 , 09:05   Re: Menu inside a Menu
Reply With Quote #4

Quote:
Originally Posted by MaNaReaver View Post
Thanks Aoi, I tried implementing a submenu, but when I select it, it doesn't open the submenu, but gets stuck at the mainmenu itself. This is a variation of code I wrote, where cmdMenu is where I add the menus.

PHP Code:
public handleMainMenu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }

    new 
szData[6], szName[64], accesscallback;
    
menu_item_getinfo(menuitemaccessszDatacharsmax(szData), szNamecharsmax(szName), callback);

    switch (
item)
    {
        case 
0cmdSubMenu1(id);
        case 
1cmdSubMenu2(id);
        case 
2cmdSubMenu3(id);
        case 
3cmd1(id);
        case 
4cmd2(id);
        case 
5cmd3(id);
        case 
6cmd4(id);
        case 
7cmd5(id);
        case 
8cmd6(id);
        case 
9: return PLUGIN_HANDLED;
    }
    if (
item != || item != || item != 3//Reopening MainMenu for command based menu options.
        
cmdMainMenu(id);
    else 
//Should I have this to allow directing to submenus?
        
menu_destroy(menu); 

    return 
PLUGIN_HANDLED;

Oh damn, I should've used && instead of ||, silly me. It's working great now, thanks again Aoi!
MaNaReaver is offline