Raised This Month: $ Target: $400
 0% 

Help for sub menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GarbageBox
Senior Member
Join Date: Feb 2010
Old 04-28-2011 , 12:35   Help for sub menu
Reply With Quote #1

Why after I press management , I press whatever it will return to management again?
Code:
public cmdMainMenu(id)
{
	new szUser[32]
	get_user_name( id, szUser, 31 )
	new szBuffer[64];
	format(szBuffer, 63, "\d[%s] \yMain menu", szUser);
	new menu = menu_create(szBuffer, "menu_handler");

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

	menu_additem(menu, "Management", "1", 0);

	menu_display(id, menu, 0);
} 

public menu_handler(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new data[6], iName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), iName,charsmax(iName), callback);

	new key = str_to_num(data);

	switch(key)
	{
		case 1:
		{
			cmdMainMenu_Sub_1(id);
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}

public cmdMainMenu_Sub_1(id)
{
	new szUser[32]
	get_user_name( id, szUser, 31 )
	new szBuffer[64];
	format(szBuffer, 63, "\d[%s] \yManagement", szUser);
	new menu = menu_create(szBuffer, "menu_handler_Sub_1");
		
	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);

	menu_additem(menu, "Ban menu", "1", 0);
	menu_additem(menu, "Kick menu", "2", 0);
	menu_additem(menu, "Slay menu", "3", 0);
	menu_additem(menu, "Team menu", "4", 0);

	menu_display(id, menu, 0);
} 


public menu_handler_Sub_1(id, menu, item)
{
	if( item == MENU_EXIT )
	{
		menu_destroy(menu);
		return PLUGIN_HANDLED;
	}

	new data[6], iName[64];
	new access, callback;
	menu_item_getinfo(menu, item, access, data,charsmax(data), iName,charsmax(iName), callback);

	new key = str_to_num(data);

	switch(key)
	{
		case 1:
		{
			displayBanMenu(id, g_menuPosition[id]);
		}
		case 2:
		{
			displayKickMenu(id, g_menuPosition[id]);
		}
		case 3:
		{
			displaySlapMenu(id, g_menuPosition[id]);
		}
		case 4:
		{
			displayTeamMenu(id, g_menuPosition[id]);
		}
	}

	menu_destroy(menu);
	return PLUGIN_HANDLED;
}
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others
GarbageBox is offline
 


Thread Tools
Display Modes

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 04:23.


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