|
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
|

05-08-2010
, 20:25
menu in a menu IN a menu (3rd menu)
|
#1
|
well, ive been working with overkill, and now im on to menus..
I wont be showing the _whole_ first menu, because im assuming you will know what im going for when I show you these code snippets, and also, menu 1 is about 400 lines
PHP Code:
case 11:
{
wpnmenu(id);
}
PHP Code:
public wpnmenu(id)
{
new menu = menu_create("Weapon Purchasing Menu:", "wpnmenu_handler")
menu_additem(menu, "Slot1 Weapons", "1", 0);
/*menu_additem(menu, "Slot2 Weapons", "2", 0);
menu_additem(menu, "Slot3 Weapons", "3", 0);
menu_additem(menu, "Slot4 Weapons", "4", 0);
menu_additem(menu, "Slot5 Weapons", "5", 0);*/
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public wpnmenu_handler(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
//If they are still connected
if( is_user_connected(id) )
//Lets send them back to the top menu
wpnmenu(id);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
client_print(id,print_chat,"[OK] button 1 pressed!!")
wm1_menu(id);
}
}
menu_destroy(menu);
//Here you might want to show the submenu or the top menu again.
//bb_menu(id);
return PLUGIN_HANDLED;
}
PHP Code:
public wm1_menu(id)
{
new menu = menu_create("Slot1 Weapons:", "wm1_handler")
menu_additem(menu,"Buy Crowbar for 20 blood.","1", 0);
menu_additem(menu,"Buy Wrench for 20 blood.","2", 0);
menu_additem(menu,"Buy Knife for 20 blood.","3", 0);
menu_additem(menu,"Buy Medkit for 20 blood.","4", 0);
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
menu_display(id, menu, 0);
}
public wm1_hander(id, menu, item)
{
if( item == MENU_EXIT )
{
menu_destroy(menu);
//If they are still connected
if( is_user_connected(id) )
//Lets send them back to the top menu
wpnmenu(id);
return PLUGIN_HANDLED;
}
new data[6], iName[64];
new access, callback;
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
new key = str_to_num(data);
switch(key)
{
case 1:
{
if(CheckBank(id, 20))
{
giveweapon(id,1)
client_print(id,print_chat,"[OK] You recieved the Axe!")
wpnmenu(id);
}
else if(!CheckBank(id, 20))
{
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:20 Have:%d",g_bhealth[id])
}
}
case 2:
{
if(CheckBank(id, 20))
{
giveweapon(id,2)
client_print(id,print_chat,"[OK] You recieved the Spanner!")
wpnmenu(id);
}
else if(!CheckBank(id, 20))
{
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:20 Have:%d",g_bhealth[id])
}
}
case 3:
{
if(CheckBank(id, 20))
{
giveweapon(id,3)
client_print(id,print_chat,"[OK] You recieved the Knife!")
wpnmenu(id);
}
else if(!CheckBank(id, 20))
{
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:20 Have:%d",g_bhealth[id])
}
}
case 4:
{
if(CheckBank(id, 20))
{
giveweapon(id,3)
client_print(id,print_chat,"[OK] You recieved the Medikit!")
wpnmenu(id);
}
else if(!CheckBank(id, 20))
{
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:20 Have:%d",g_bhealth[id])
}
}
}
menu_destroy(menu);
//Here you might want to show the submenu or the top menu again.
//bb_menu(id);
return PLUGIN_HANDLED;
}
all stocks are functioning properly, first two menus function normally, but the third menu is never "called" on, I get the message saying button 1 was pressed, but thats all that happens, after that the menu is destroyed with no new menu, so I have a couple questions..
1) can I do this many sub-menus? I didnt think there is a limit, but I could be wrong.
2) what am I doing wrong?
__________________
|
|