Raised This Month: $ Target: $400
 0% 

menu keys disappears


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Pattinho
Member
Join Date: Dec 2007
Old 12-10-2011 , 08:35   menu keys disappears
Reply With Quote #1

Hey guys,

i got again a problem. I wanna do my own team select menu and it should shows like :
1. Teamname 1
2. Teamname 2

5. Auto-Select
6.Spectator

Well this is no problem with menu_addblank but when i do this, key 5 and 6 just disappears and he selects nothing. Why he is doing that ?

PHP Code:
public teamselect(id)
 {
     new 
teamname1[64]
    new 
teamname2[64]
    new 
menu menu_create("Team Select:""action_team_select")
    
get_cvar_string("sj_team1",teamname1,63);
    
get_cvar_string("sj_team2",teamname2,63);
    
menu_additem(menu,teamname1 "1"0);
    
menu_additem(menu,teamname2"2"0);
    
menu_addblank(menu);
    
menu_addblank(menu)
    
menu_additem(menu,"Auto-Select","5",0);
    
menu_additem(menu"Spectator","6",0);
    

    
menu_setprop(menuMPROP_EXITMEXIT_NEVER);
    
menu_display(idmenu0);
 }
 public 
action_team_select(idmenuitem)
 {
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);
client_print(0,print_chat,"%d"key)
    switch(
key)
    {
    case 
1:
    {
        
engclient_cmd(id"menuselect""1");
    }
    case 
2:
    {
        
engclient_cmd(id"menuselect""2")
    }
    case 
5:
    {
        
engclient_cmd(id"menuselect""5")
        
    }
    case 
6:
    {
        
engclient_cmd(id"menuselect""6")
    }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 
Pattinho is offline
Ex1ne
Senior Member
Join Date: Oct 2011
Location: Norway
Old 12-11-2011 , 05:48   Re: menu keys disappears
Reply With Quote #2

I'm not sure, but i think

Code:
    menu_addblank(menu); 
    menu_addblank(menu)

Code:
    menu_addblank(menu); 
    menu_addblank(menu);
Ex1ne is offline
Kidev
Veteran Member
Join Date: Jun 2010
Location: France
Old 12-11-2011 , 08:07   Re: menu keys disappears
Reply With Quote #3

Quote:
Originally Posted by Ex1ne View Post
I'm not sure, but i think

Code:
    menu_addblank(menu); 
    menu_addblank(menu)

Code:
    menu_addblank(menu); 
    menu_addblank(menu);
lol...

Try this:
PHP Code:
public teamselectid )
{
    new 
teamname164 ];
    new 
teamname264 ];

    new 
menu menu_create"Team Select:""action_team_select" );
    
get_cvar_string"sj_team1"teamname1charsmaxteamname1 ) );
    
get_cvar_string"sj_team2"teamname2charsmaxteamname2 ) );

    
menu_additemmenuteamname1 );
    
menu_additemmenuteamname2 );
    
menu_addblankmenu);
    
menu_addblankmenu);
    
menu_additemmenu"Auto-Select" );
    
menu_additemmenu"Spectator" );

    
menu_setpropmenuMPROP_EXITMEXIT_NEVER);
    
menu_displayidmenu );
}

public 
action_team_selectidmenuitem )
{
    if ( 
item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }

    switch ( 
item )
    {
        case 
0:
        {
            
engclient_cmdid"menuselect""1" );
        }
        case 
1:
        {
            
engclient_cmdid"menuselect""2" );
        }
        case 
2:
        {
            
engclient_cmdid"menuselect""5" );
        }
        case 
3:
        {
            
engclient_cmdid"menuselect""6" );
        }
    }

    
menu_destroymenu );
    return 
PLUGIN_HANDLED;

__________________

Last edited by Kidev; 12-11-2011 at 08:09.
Kidev is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 12-11-2011 , 11:51   Re: menu keys disappears
Reply With Quote #4

engclient_cmd( id, "menuselect", "1" );

->

engclient_cmd( id, "menuselect 1" );
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Kidev
Veteran Member
Join Date: Jun 2010
Location: France
Old 12-11-2011 , 12:59   Re: menu keys disappears
Reply With Quote #5

Quote:
Originally Posted by Devil259 View Post
engclient_cmd( id, "menuselect", "1" );

->

engclient_cmd( id, "menuselect 1" );
It's not client_cmd(), look there: http://www.amxmodx.org/funcwiki.php?go=func&id=231
__________________
Kidev is offline
Old 12-11-2011, 13:01
ConnorMcLeod
This message has been deleted by ConnorMcLeod. Reason: hi
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-11-2011 , 13:05   Re: menu keys disappears
Reply With Quote #7

How is teamselect registered ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Pattinho
Member
Join Date: Dec 2007
Old 12-12-2011 , 13:00   Re: menu keys disappears
Reply With Quote #8

PHP Code:
    register_event("ShowMenu""teamselect""b""4&Team_Select")
    
register_event("ShowMenu""posselect","b""4&CT_Select")
    
register_event("ShowMenu""posselect","b""4&Terrorist_Select"
and

PHP Code:
set_user_info(id"_vgui_menus""0"
I have just the Problem, i can only use key 1 and key 2, well i can select team. But key 5 and 6 disappears and aren't available or what ever. I tested already which keys i actual press. 1 and 2 no problem but when i press 5 no chat.

Is it maybe a buq in addblank ? because without blank it works perfectly

Last edited by Pattinho; 12-12-2011 at 13:05.
Pattinho is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-13-2011 , 12:04   Re: menu keys disappears
Reply With Quote #9

May be this can help you, partially : http://forums.alliedmods.net/showthread.php?t=130708
Look only at menus that contain "Team_Select" and notive that keys are not the same in all menus, sometimes you have spec option sometimes you have not, same for exit key, and other specific vip maps.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Pattinho
Member
Join Date: Dec 2007
Old 12-14-2011 , 06:39   Re: menu keys disappears
Reply With Quote #10

Mhh Thanks for it and i undestood what you said but i dont know which code could help me.
Well, i tested it with menu_addblank(menu, 0) now it works but the numbers are wrong. Have now like:
1. team 1
2. team 2


3. auto-select
4. spectator

But i want like in original, 5. auto-select and 6. spectator but with only menu_addblank(menu) dont work


*EDIT

For everyone who got the same problem. I have used now the old menu system and now it works perfectly.

PHP Code:
public plugin_init() {
register_event("ShowMenu""menu_show""b""4&Team_Select")
        
register_event("ShowMenu""posselect","b""4&CT_Select")
        
register_event("ShowMenu""posselect","b""4&Terrorist_Select")
        
register_menucmd(register_menuid("Menu"),1023,"menu_key")}

public 
menu_show(id)
{
    new 
menu[256]
    new 
keys MENU_KEY_1|MENU_KEY_2|MENU_KEY_5|MENU_KEY_6
    
new teamname1[64]
    new 
teamname2[64]
    
get_cvar_string("sj_team1",teamname1,63);
    
get_cvar_string("sj_team2",teamname2,63);
    
    new 
len format(menu255"\rTeam - Select^n^n")
    
len len format(menu[len], 255 len"1. %s^n"teamname1)
    
len len format(menu[len], 255 len"2. %s^n^n"teamname2)
    
len len format(menu[len], 255 len"5. Auto-Select^n")
    
len len format(menu[len], 255 len"6. Spectator")
    
show_menu(idkeysmenu)
    
    return 
FMRES_IGNORED
}
public 
menu_key(id,key,menu)
{
key += 1

if(key.....)


Last edited by Pattinho; 12-19-2011 at 06:45.
Pattinho 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 11:48.


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