Raised This Month: $ Target: $400
 0% 

menu in a menu IN a menu (3rd menu)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-08-2010 , 20:25   menu in a menu IN a menu (3rd menu)
Reply With Quote #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(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
wpnmenu_handler(idmenuitem)
{
    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 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    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(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
wm1_hander(idmenuitem)
{
    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 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if(
CheckBank(id20))
            {
                
giveweapon(id,1)
                
client_print(id,print_chat,"[OK] You recieved the Axe!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id20))
            {
                
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(id20))
            {
                
giveweapon(id,2)
                
client_print(id,print_chat,"[OK] You recieved the Spanner!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id20))
            {
                
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(id20))
            {
                
giveweapon(id,3)
                
client_print(id,print_chat,"[OK] You recieved the Knife!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id20))
            {
                
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(id20))
            {
                
giveweapon(id,3)
                
client_print(id,print_chat,"[OK] You recieved the Medikit!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id20))
            {
                
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?
__________________
+|- KARMA Respectively

HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 21:23   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #2

I don't see anything wrong with the code at the moment. What I would do is put in a client_print() in wm1_menu().

Any errors in the logs?
__________________
fysiks is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-08-2010 , 21:38   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post

Any errors in the logs?
125mb error log just for today, uhh.. ill tell you when its done, lol

edit: no, no errors, added a check, and the check says its loading

PHP Code:
public wm1_menu(id)
{
    
client_print(id,print_chat,"[OK] weaponmenu1 opened!!")
    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_additem(menu,"Buy All Slot1 Weapons for 100 blood","5"0);
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);

__________________
+|- KARMA Respectively


Last edited by HLM; 05-08-2010 at 21:56.
HLM is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-08-2010 , 21:47   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #4

Quote:
Originally Posted by HLM View Post
125mb error log just for today, uhh.. ill tell you when its done, lol
Show us some of it. How else do you expect us to assist?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 21:52   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #5

Quote:
Originally Posted by HLM View Post
ill tell you when its done, lol
I'm bored. I want it NOW.
__________________
fysiks is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-08-2010 , 22:06   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #6

cant paste it at pastebin, a bit too big to upload it, ill have to upload it to my servers directory..

http://redirect.chi.gameservers.com/...3.97/giant.log

anyways, I added the check, and the menu is opened, but nothing is displayed..

PHP Code:
public wm1_menu(id)
{
    
client_print(id,print_chat,"[OK] weaponmenu1 opened!!")
    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_additem(menu,"Buy All Slot1 Weapons for 100 blood","5"0);
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
wm1_hander(idmenuitem)
{
    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 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if(
CheckBank(id30))
            {
                
giveweapon(id,1)
                
client_print(id,print_chat,"[OK] You recieved the Axe!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id30))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:30 Have:%d",g_bhealth[id])
            }
        }
        case 
2:
        {
            if(
CheckBank(id30))
            {
                
giveweapon(id,2)
                
client_print(id,print_chat,"[OK] You recieved the Spanner!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id30))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:30 Have:%d",g_bhealth[id])
            }
        }
        case 
3:
        {
            if(
CheckBank(id30))
            {
                
giveweapon(id,3)
                
client_print(id,print_chat,"[OK] You recieved the Knife!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id30))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:30 Have:%d",g_bhealth[id])
            }
            
        }
        case 
4:
        {
            if(
CheckBank(id30))
            {
                
giveweapon(id,3)
                
client_print(id,print_chat,"[OK] You recieved the Medikit!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id30))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:30 Have:%d",g_bhealth[id])
            }
        }
        case 
5:
        {
            if(
CheckBank(id100))
            {
                
giveweapon(id,9)
                
client_print(id,print_chat,"[OK] You recieved all slot1 weapons!")
                
wpnmenu(id);
            }
            else if(!
CheckBank(id100))
            {
                
client_print(id,print_chat,"[OK] You do not have enough blood for this. Cost:100 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;

it tells me the menu is opened, but I never see a menu

ERRORS!!! D:
PHP Code:
L 05/08/2010 20:54:32Start of error session.
L 05/08/2010 20:54:32Info (map "crossover2") (file "addons/amxmodx/logs/error_20100508.log")
L 05/08/2010 20:54:32Invalid function "wm1_handler"
L 05/08/2010 20:54:32: [AMXXDisplaying debug trace (plugin "overkill.amxx")
L 05/08/2010 20:54:32: [AMXXRun time error 19: function not found 
L 05
/08/2010 20:54:32: [AMXX]    [0overkill.sma::wm1_menu (line 1052)
L 05/08/2010 20:54:32: [AMXX]    [1overkill.sma::wpnmenu_handler (line 1033)
L 05/08/2010 21:02:09Invalid function "wm1_handler"
L 05/08/2010 21:02:09: [AMXXDisplaying debug trace (plugin "overkill.amxx")
L 05/08/2010 21:02:09: [AMXXRun time error 19: function not found 
L 05
/08/2010 21:02:09: [AMXX]    [0overkill.sma::wm1_menu (line 1052)
L 05/08/2010 21:02:09: [AMXX]    [1overkill.sma::wpnmenu_handler (line 1033)
L 05/08/2010 21:21:37Invalid function "wm2_handler"
L 05/08/2010 21:21:37: [AMXXDisplaying debug trace (plugin "overkill.amxx")
L 05/08/2010 21:21:37: [AMXXRun time error 19: function not found 
L 05
/08/2010 21:21:37: [AMXX]    [0overkill.sma::wm2_menu (line 1165)
L 05/08/2010 21:21:37: [AMXX]    [1overkill.sma::wpnmenu_handler (line 1037
Code:
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);
		}
		case 2:
		{
			wm2_menu(id);
		}
		case 3:
		{
			wm3_menu(id);
		}
	}
	
	menu_destroy(menu);
	
	//Here you might want to show the submenu or the top menu again.
	//bb_menu(id);
	
	return PLUGIN_HANDLED;
}
//line 1052
wm1_menu is directly underneath wpnmenu_handler
__________________
+|- KARMA Respectively


Last edited by HLM; 05-08-2010 at 22:22.
HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 22:52   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #7

Code:
public wm1_hander(id, menu, item)


Code:
public wm1_handler(id, menu, item)
That's an "L" not a 1 .
__________________
fysiks is offline
HLM
Senior Member
Join Date: Apr 2008
Location: C:\WINDOWS\System32
Old 05-08-2010 , 22:54   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
Code:
public wm1_hander(id, menu, item)


Code:
public wm1_handler(id, menu, item)
human error: the hardest error to fix, thanks fysiks
__________________
+|- KARMA Respectively

HLM is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2010 , 22:55   Re: menu in a menu IN a menu (3rd menu)
Reply With Quote #9

Quote:
Originally Posted by HLM View Post
human error: the hardest error to fix, thanks fysiks
So true! lol. np.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:32.


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