Raised This Month: $51 Target: $400
 12% 

New AMXX Menu System


Post New Thread Reply   
 
Thread Tools Display Modes
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 08-17-2009 , 15:01   Re: New AMXX Menu System
Reply With Quote #121

But how to detect if the menu was replaced by another menu instead of being closed?
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!

LaineN is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-17-2009 , 15:06   Re: New AMXX Menu System
Reply With Quote #122

If you only use those 5 submenus then it will work perfectly. If you overwrite the menu with some other menu not in this heirarchy then you would set the value of g_iCurrentMenu appropriately.
__________________
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-17-2009 , 15:24   Re: New AMXX Menu System
Reply With Quote #123

Quote:
Originally Posted by LaineN View Post
But how to detect if the menu was replaced by another menu instead of being closed?
If a menu overwrites another menu, MENU_EXIT is called on the first menu.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Old 08-17-2009, 16:30
Alka
This message has been deleted by Alka. Reason: Problem solved.
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 08-17-2009 , 20:15   Re: New AMXX Menu System
Reply With Quote #124

Quote:
Originally Posted by Alka View Post
A little kinda OFF-Topic, but on OldMenus overwrite can be detected ?
Correct.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 08-18-2009 , 03:36   Re: New AMXX Menu System
Reply With Quote #125

It doesn't detect old menus for me.

I use this plugin to see what g_current_menu[id] is:

PHP Code:
#include <amxmodx>
#include <engine>

enum
{
    
MENU_NONE,
    
    
MENU_MAIN,
    
MENU_SUB1,
    
MENU_SUB2,
    
MENU_SUB3,
    
MENU_SUB4,
    
MENU_SUB5
};

new 
g_current_menu[33];

public 
plugin_init()
{
    
register_clcmd("say /menu""ShowMainMenu");
}

public 
client_putinserver(id)
{
    
g_current_menu[id] = MENU_NONE;
}

public 
client_PreThink(id)
{
    if ( 
is_user_connected(id) )
    {
        
set_hudmessage(255255255, -1.00.000.01.00.250.25, -1);
        
show_hudmessage(id"g_current_menu[id] = %i"g_current_menu[id]);
    }
}

public 
ShowMainMenu(id)
{
    
g_current_menu[id] = MENU_MAIN;
    
    new 
menu menu_create("Main Menu""MainMenuHandle");
    
menu_additem(menu"Sub Menu 1""1");
    
menu_additem(menu"Sub Menu 2""2");
    
menu_additem(menu"Sub Menu 3""3");
    
menu_additem(menu"Sub Menu 4""4");
    
menu_additem(menu"Sub Menu 5""5");
    
    
menu_display(idmenu);
}

public 
MainMenuHandle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
g_current_menu[id] = MENU_NONE;
        
menu_destroy(menu);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'ShowSubMenu1(id);
        case 
'2'ShowSubMenu2(id);
        case 
'3'ShowSubMenu3(id);
        case 
'4'ShowSubMenu4(id);
        case 
'5'ShowSubMenu5(id);
    }
}

public 
ShowSubMenu1(id)
{
    
g_current_menu[id] = MENU_SUB1;
    
    new 
menu menu_create("Sub Menu 1""SubMenu1Handle");
    
menu_additem(menu"1""1");
    
menu_additem(menu"2""2");
    
menu_additem(menu"3""3");
    
menu_additem(menu"4""4");
    
menu_additem(menu"5""5");
    
menu_additem(menu"6""6");
    
    
menu_display(idmenu);
}

public 
SubMenu1Handle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
ShowMainMenu(id);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'client_print(idprint_chat"You selected 1");
        case 
'2'client_print(idprint_chat"You selected 2");
        case 
'3'client_print(idprint_chat"You selected 3");
        case 
'4'client_print(idprint_chat"You selected 4");
        case 
'5'client_print(idprint_chat"You selected 5");
        case 
'6'client_print(idprint_chat"You selected 6");
    }
    
    
ShowSubMenu1(id);
}

public 
ShowSubMenu2(id)
{
    
g_current_menu[id] = MENU_SUB2;
    
    new 
menu menu_create("Sub Menu 2""SubMenu2Handle");
    
menu_additem(menu"1""1");
    
menu_additem(menu"2""2");
    
menu_additem(menu"3""3");
    
menu_additem(menu"4""4");
    
menu_additem(menu"5""5");
    
menu_additem(menu"6""6");
    
    
menu_display(idmenu);
}

public 
SubMenu2Handle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
ShowMainMenu(id);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'client_print(idprint_chat"You selected 1");
        case 
'2'client_print(idprint_chat"You selected 2");
        case 
'3'client_print(idprint_chat"You selected 3");
        case 
'4'client_print(idprint_chat"You selected 4");
        case 
'5'client_print(idprint_chat"You selected 5");
        case 
'6'client_print(idprint_chat"You selected 6");
    }
    
    
ShowSubMenu2(id);
}

public 
ShowSubMenu3(id)
{
    
g_current_menu[id] = MENU_SUB3;
    
    new 
menu menu_create("Sub Menu 3""SubMenu3Handle");
    
menu_additem(menu"1""1");
    
menu_additem(menu"2""2");
    
menu_additem(menu"3""3");
    
menu_additem(menu"4""4");
    
menu_additem(menu"5""5");
    
menu_additem(menu"6""6");
    
    
menu_display(idmenu);
}

public 
SubMenu3Handle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
ShowMainMenu(id);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'client_print(idprint_chat"You selected 1");
        case 
'2'client_print(idprint_chat"You selected 2");
        case 
'3'client_print(idprint_chat"You selected 3");
        case 
'4'client_print(idprint_chat"You selected 4");
        case 
'5'client_print(idprint_chat"You selected 5");
        case 
'6'client_print(idprint_chat"You selected 6");
    }
    
    
ShowSubMenu3(id);
}

public 
ShowSubMenu4(id)
{
    
g_current_menu[id] = MENU_SUB4;
    
    new 
menu menu_create("Sub Menu 4""SubMenu4Handle");
    
menu_additem(menu"1""1");
    
menu_additem(menu"2""2");
    
menu_additem(menu"3""3");
    
menu_additem(menu"4""4");
    
menu_additem(menu"5""5");
    
menu_additem(menu"6""6");
    
    
menu_display(idmenu);
}

public 
SubMenu4Handle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
ShowMainMenu(id);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'client_print(idprint_chat"You selected 1");
        case 
'2'client_print(idprint_chat"You selected 2");
        case 
'3'client_print(idprint_chat"You selected 3");
        case 
'4'client_print(idprint_chat"You selected 4");
        case 
'5'client_print(idprint_chat"You selected 5");
        case 
'6'client_print(idprint_chat"You selected 6");
    }
    
    
ShowSubMenu4(id);
}

public 
ShowSubMenu5(id)
{
    
g_current_menu[id] = MENU_SUB5;
    
    new 
menu menu_create("Sub Menu 5""SubMenu5Handle");
    
menu_additem(menu"1""1");
    
menu_additem(menu"2""2");
    
menu_additem(menu"3""3");
    
menu_additem(menu"4""4");
    
menu_additem(menu"5""5");
    
menu_additem(menu"6""6");
    
    
menu_display(idmenu);
}

public 
SubMenu5Handle(idmenuitem)
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        
ShowMainMenu(id);
        return;
    }
    
    static 
_accessinfo[3], callback;
    
menu_item_getinfo(menuitem_accessinfocharsmax(info), __callback);
    
menu_destroy(menu);
    
    switch ( 
info[0] )
    {
        case 
'1'client_print(idprint_chat"You selected 1");
        case 
'2'client_print(idprint_chat"You selected 2");
        case 
'3'client_print(idprint_chat"You selected 3");
        case 
'4'client_print(idprint_chat"You selected 4");
        case 
'5'client_print(idprint_chat"You selected 5");
        case 
'6'client_print(idprint_chat"You selected 6");
    }
    
    
ShowSubMenu5(id);

And when I overwrite for example 'Main Menu' with the 'AMX Mod X Menu' or 'Select a team' menu, the value of g_current_menu[id] still is 1. But when I overwrite it with a menu from any of my own plugins with new menu system the value goes to 0.

Is there a way to detect the old menu overwrites?
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!

LaineN is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-18-2009 , 03:45   Re: New AMXX Menu System
Reply With Quote #126

Try:
Code:
new bool:g_bShowingMenu[ 33 ]; public plugin_init( ) {     register_message( get_user_msgid( "ShowMenu" ), "MessageShowMenu" ); } public MessageShowMenu( iMsgId, iDest, client ) {     if( g_bShowingMenu[ client ] )     {         g_bShowingMenu[ client ] = false;         return;     }         // player opened a new menu } ShowYourOwnMenu( client ) {     g_bShowingMenu[ client ] = true;         // show menu }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 08-18-2009 , 06:02   Re: New AMXX Menu System
Reply With Quote #127

I believe you should also hook death, spawn and disconnect if you want to know surely a player is viewing some menu.
SnoW is offline
Send a message via MSN to SnoW
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 08-18-2009 , 15:56   Re: New AMXX Menu System
Reply With Quote #128

Quote:
Originally Posted by Exolent[jNr] View Post
Try:
Lol! That worked for 'Buy Menu' and 'Select a team' menu, but not for 'AMX Mod X Menu'. Is there any differences between them?

EDIT: I have one more problem with this menus :/

If I have a menu like this:
PHP Code:
new menu menu_create("Main Menu""MainMenuHandle");
menu_additem(menu"1""1");
menu_additem(menu"2""2");
menu_additem(menu"3""3");
menu_additem(menu"4""4");
menu_additem(menu"5""5");
menu_additem(menu"6""6");
menu_additem(menu"7""7");
menu_additem(menu"8""8");

menu_display(idmenu); 
The menu automatically adds an Next and a Back for the menu and the 8 will be in the second page.
I've tried with menu_setprop(menu, MPROP_PERPAGE, 0); and I get them on the same page but the Exit button disappear, do I have to add it by myself to get it to work or is there any other way?
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!


Last edited by LaineN; 08-18-2009 at 16:11.
LaineN is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-18-2009 , 16:52   Re: New AMXX Menu System
Reply With Quote #129

Try menu_setprop( menu, MPROP_PERPAGE, 8 );
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-18-2009 , 16:58   Re: New AMXX Menu System
Reply With Quote #130

Quote:
Originally Posted by Alka View Post
Try menu_setprop( menu, MPROP_PERPAGE, 8 );
Doesn't work.
I've tried it and it gave me an error in the logs saying that you can't have more than 7 per page.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 09:13.


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