View Single Post
Adomaz1
Senior Member
Join Date: Feb 2014
Old 09-24-2016 , 15:24   Re: menu doesnt destroy
Reply With Quote #4

i edited the code, now it works, but if the player has an other menu opened, it will destroy too. how can i make that only this menu would close?

Code:
#include <amxmodx>
#include <amxmisc>

public plugin_init() {

    register_plugin("Button Menu","1.0","Adomaz");
	register_clcmd("chooseteam", "clcmd_chooseteam");
	
	register_logevent("roundstart", 2, "0=World triggered", "1=Round_Start");
	
	register_dictionary("buttonmenu.txt");
}

public roundstart()
{
    set_task(5.0, "DestroyMenu")
}

public DestroyMenu(id)
{
    show_menu(id, 0, "^n", 1);
} 

public clcmd_chooseteam(id)
{
		show_menu_main(id)
		return PLUGIN_HANDLED;
}

show_menu_main(id)
{
	new data[64];
	formatex(data, charsmax(data), "%L", id, "b4");
	new menu = menu_create(data , "mh_MyMenu");

	formatex(data, charsmax(data), "%L", id, "b2");
	menu_additem(menu , data , "0" , 0);
	
    menu_display(id , menu , 0);

	return PLUGIN_CONTINUE
}

public mh_MyMenu(id, menu, item)
{
	new command[6], name[64], access, callback;

	menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

	switch(item)
	{
		//case 0: 
	}

	menu_destroy(menu);

	return PLUGIN_HANDLED;
}
Adomaz1 is offline