Quote:
Originally Posted by r4ndomz
I made a plugin earlier with emps menu tutorial and when i press an option the menu closes. How should i fix it? I tried to my opinion alot of ways
|
Like fysiks said, it's supposed to close. If you want to be able to choose another item from the same menu prior to your first choice, in the case handler, just execute the things that you want to happen and then re-display the menu.
PHP Code:
#include <amxmodx>
new m_YourMenu;
new const VERSION[] = "0.0.1";
public plugin_init() {
register_plugin( "Menu Example", VERSION, "wrecked_" );
register_clcmd( "say /menu", "cmd_Menu" );
}
public cmd_Menu( id )
{
m_YourMenu = menu_create( "Example Menu", "cmd_MenuHandler" );
menu_additem( m_YourMenu, "Example #1", "1", 0 );
menu_additem( m_YourMenu, "Example #2", "2", 0 );
menu_setprop( m_YourMenu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, m_YourMenu, 0 );
return PLUGIN_CONTINUE;
}
public cmd_MenuHandler( id, m_YourMenu, item )
{
if( item == MENU_EXIT )
{
menu_destroy( m_YourMenu );
return PLUGIN_HANDLED;
}
new sz_Name[64];
new sz_Data[64];
new access;
new callback;
// All that good stuff
menu_item_getinfo( m_YourMenu, item, access, sz_Data, 5, sz_Name, 63, callback );
new key = str_to_num( sz_Data );
switch( key )
{
case 1:
{
// Your Stuff
menu_display( id, m_YourMenu, 0 );
}
case 2:
{
// Your Stuff
menu_display( id, m_YourMenu, 0 );
}
// ...
}
}
__________________