AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu to menu? (https://forums.alliedmods.net/showthread.php?t=28525)

Drak 05-16-2006 20:47

Menu to menu?
 
I was making a gun buy menu, but when they select the gun type how do I make it go to another menu displaying the guns? Here's my current code.
Code:
new g_Menu   public plugin_init()   {       register_plugin(PLUGIN, VERSION, AUTHOR)             register_clcmd("say /guns", "Menu_Command")             g_Menu = menu_create("Weapon menu", "Menu_Handle")       menu_additem(g_Menu, "Pistol", "1")       menu_additem(g_Menu, "SMG", "2")       menu_additem(g_Menu, "Rifle", "3")       menu_additem(g_Menu, "Other", "4") }   public Menu_Command(id, level, cid)   {       menu_display(id, g_Menu, 0)             return PLUGIN_HANDLED   }   public Menu_Handle(id, Menu, Item)   {       new szCommand[3],  Accesss, Callback             menu_item_getinfo(Menu, Item, Accesss, szCommand, 2, _, _, Callback)             switch(szCommand[0])       {           case '-':           {               return PLUGIN_HANDLED           }                     case '1':           {               client_print(id,print_chat,"No function yet")         }                     case '2':           {                client_print(id,print_chat,"No function yet")         }                     case '3':           {             client_print(id,print_chat,"No function yet")         }                     case '4':           {               client_print(id,print_chat,"No function yet")         }                   }             return PLUGIN_HANDLED   }

SubStream 05-18-2006 15:33

I don't build menus that way using menu_additem but if you want to redo from scratch I would suggest doing you rmenu in the same format as ataccfg.amxx

If you look at the way they did their menu and use it as an outline you can't go wrong. It's pretty simple to understand if you take the time to look at it.

Freddy 05-19-2006 01:10

woah

Major_victory 10-01-2006 00:23

Re: Menu to menu?
 
Create the sub menus first. add a call funtion for each, and add a handler function for each. then in your main menu use the switch statement to call the submenu like you would the first.

Code:

//Setup the Pistols menu here
 
public Menu_Pistols(id, level, cid) 
{ 
    menu_display(id, g_PistolMenu, 0)
    return PLUGIN_HANDLED 
}
 
//Then in the Menu_Handle switch statement use
case '1'
        { 
            Menu_Pistols()       
        }

I hope I wrote this understandably, btw because of you i finally figured out how to retrive what button was being sent, Thx man

stupok 10-01-2006 02:43

Re: Menu to menu?
 
@Sixtwin

I'd really appreciate it if you posted the working version of this plugin when you are done adding to it, because I could make use of it on my server with a few modifications :D


All times are GMT -4. The time now is 16:30.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.