Raised This Month: $ Target: $400
 0% 

Menu Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
pRED*
Join Date: Dec 2006
Old 05-02-2007 , 03:32   Menu Problem
Reply With Quote #1

Can someone please help me figure out why this doesn't work
The register_menucmd's are in plugin init.. and all the client print's are to help find where the error is..

Code:
    register_menucmd(register_menuid("menu_bf2badge"),1023,"MenuBadge_ChooseOption");     register_menucmd(register_menuid("menu_bf2badgelevel"),1023,"MenuBadgeLevel_ChooseOption"); public badgemenu(id) {     if (!get_pcvar_num(g_bf2_active))         return PLUGIN_CONTINUE     if (!(get_user_flags(id) & ADMIN_LEVEL))     {         client_print(id,print_chat,"You do not have access to this menu")         console_print(id,"You do not have access to this menu")         return PLUGIN_CONTINUE     }         new menu[] = "BFHQ: Select Badge^n^n1. Knife Combat^n2. Pistol Combat^n3. Assault Combat^n4. Sniper Combat^n5. Support Combat^n6. Explosives Ordinance^n7. Shotgun Combat^n8. SMG Combat^n^n0. Exit"     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8             show_menu(id, keys, menu, -1, "menu_bf2badge")     return PLUGIN_CONTINUE       } public badgelevelmenu(id) {     if (!get_pcvar_num(g_bf2_active))         return PLUGIN_CONTINUE     if (!(get_user_flags(id) & ADMIN_LEVEL))     {         client_print(id,print_chat,"You do not have access to this menu")         console_print(id,"You do not have access to this menu")         return PLUGIN_CONTINUE     }         new menu[] = "BFHQ: Select Level^n^n1. None^n2. Basic^n3. Veteran^n4. Expert^n^n0. Exit"     new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4             show_menu(id, keys, menu, -1, "menu_bf2badgelevel")     return PLUGIN_CONTINUE       } public MenuBadge_ChooseOption(id, pclass:key) {     menuselected[id][0]=0     switch (key)     {     case 0: {             menuselected[id][1]=0             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 1, saved as.. %i",menuselected[id][1])         }     case 1: {             menuselected[id][1]=1             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 2, saved as.. %i",menuselected[id][1])         }     case 2: {             menuselected[id][1]=2             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 3, saved as.. %i",menuselected[id][1])         }     case 3:    {             menuselected[id][1]=3             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 4, saved as.. %i",menuselected[id][1])         }     case 4:    {             menuselected[id][1]=4             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 5, saved as.. %i",menuselected[id][1])         }     case 5:    {             menuselected[id][1]=5             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 6, saved as.. %i",menuselected[id][1])         }     case 6:    {             menuselected[id][1]=6             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 7, saved as.. %i",menuselected[id][1])         }     case 7:    {             menuselected[id][1]=7             badgelevelmenu(id);             client_print(id,print_chat,"B:You selected 8, saved as.. %i",menuselected[id][1])         }     }     return PLUGIN_HANDLED } public MenuBadgeLevel_ChooseOption(id, pclass:key) {     switch (key)     {     case 0: {             menuselected[id][2]=0             client_print(id,print_chat,"L:You selected 1, saved as.. %i",menuselected[id][2])             client_cmd(id,"messagemode PlayerName")         }     case 1: {             menuselected[id][2]=1             client_print(id,print_chat,"L:You selected 2, saved as.. %i",menuselected[id][2])             client_cmd(id,"messagemode PlayerName")         }     case 2: {             menuselected[id][2]=2             client_print(id,print_chat,"L:You selected 3, saved as.. %i",menuselected[id][2])             client_cmd(id,"messagemode PlayerName")         }     case 3:    {             menuselected[id][2]=3             client_print(id,print_chat,"L:You selected 4, saved as.. %i",menuselected[id][2])             client_cmd(id,"messagemode PlayerName")         }     }     return PLUGIN_CONTINUE } public PlayerName( id )  //Entered Player Name {     new message[192]     // Get message and remove quotes     read_args(message, 191)     remove_quotes(message)     client_print(id,print_chat,"Player name entered, raw data.. %s, %i, %i",message,menuselected[id][1],menuselected[id][2])     if (menuselected[id][0]==0) //User selected a badge     {         client_cmd(id,"bf2_addbadge ^"%s^" %i %i",message,menuselected[id][1],menuselected[id][2])     }     else //Kills     {         client_cmd(id,"bf2_addkills ^"%s^" %i",message,menuselected[id][1])     }     return PLUGIN_HANDLED }

When I try use this menu i get to the second menu but the messagemode never comes up.

Code:
B:You selected 7, saved as.. 6
B:You selected 2, saved as.. 1
Is what appears on screen. So it appears that when I select an option in the second menu it is handled by the first handler.

Changing the plugin_handled to plugin_continue on the first menu handler gives this result instead.. (the messagemode does come up but the second menu option gets handled by both menu handlers... w.t.f..)

Code:
B:You selected 6, saved as.. 5
Unknown command: PlayerName
B:You selected 3, saved as.. 2
L:You selected 3, saved as.. 2
Player name entered, raw data.. pRED*,2,2
pRED* 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 06:46.


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