Raised This Month: $ Target: $400
 0% 

2 menus, 2nd one calls 1st menus functions?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
diamond-optic
Veteran Member
Join Date: May 2005
Old 07-13-2006 , 22:02   2 menus, 2nd one calls 1st menus functions?
Reply With Quote #1

ok ive got 2 diff menus in a plugin...

but when you're on the 2nd menu and press one of the keys.. it calls the function from that key on the 1st menu...

heres what i have:

in the init:
Code:
register_menucmd(register_menuid("dod_extra_voice_menu"),1023,"MenuChoice") register_menucmd(register_menuid("dod_extra_voice_menu2"),1023,"MenuChoice2")

the show menu code itself:
Code:
public dodvoice_menu4(id) {     if(is_user_connected(id) && is_user_alive(id) && !is_user_bot(id) && !is_user_hltv(id) && (get_user_team(id) == 1 || get_user_team(id) == 2) && get_pcvar_num(p_voicemenus) == 1)         {         new menuBody[1024], key                     format(menuBody, 1023, "1. Take the flank ^n2. Cover the flanks ^n3. Drop your weapon ^n4. Take cover ^n5. Spread out ^n6. Left ^n7. Right ^n8. Tank ahead ^n9. Medic ^n0. Cancel^n", -1, "dod_extra_voice_menu")         key = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)         show_menu(id, key, menuBody, -1, "dod_extra_voice_menu")         } } public dodvoice_menu5(id) {     if(is_user_connected(id) && is_user_alive(id) && !is_user_bot(id) && !is_user_hltv(id) && (get_user_team(id) == 1 || get_user_team(id) == 2) && get_pcvar_num(p_voicemenus) == 1)         {         new menuBody2[1024], key2                       if(get_user_team(id) == 2)             format(menuBody2, 1023, "1. Prepare for the assualt ^n0. Cancel^n^n^n^n^n^n^n^n^n", -1, "dod_extra_voice_menu2")                     else if(get_user_team(id) == 1 && dod_get_map_info(MI_ALLIES_TEAM) == 1)             format(menuBody2, 1023, "1. Prepare for the assualt ^n2. Defend this objective ^n3. Defend this position ^n4. Take that objective ^n5. Bring up the piat ^n0. Cancel^n^n^n^n^n", -1, "dod_extra_voice_menu2")                   else if(get_user_team(id) == 1)             format(menuBody2, 1023, "1. Prepare for the assualt ^n0. Cancel^n^n^n^n^n^n^n^n^n", -1, "dod_extra_voice_menu2")                     key2 = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)         show_menu(id, key2, menuBody2, -1, "dod_extra_voice_menu2")         } }

the menu choice code:
Code:
public MenuChoice(id, key) {     if(is_user_connected(id) && is_user_alive(id) && !is_user_bot(id) && !is_user_hltv(id) && (get_user_team(id) == 1 || get_user_team(id) == 2) && get_pcvar_num(p_voicemenus) == 1)         {           switch (key)             {             //1             case 0: dodvoice_takeflank(id)             //2             case 1: dodvoice_cflanks(id)             //3             case 2: dodvoice_dropguns(id)             //4             case 3: dodvoice_takecover(id)             //5             case 4: dodvoice_spreadout(id)             //6             case 5: dodvoice_firmleft(id)             //7             case 6: dodvoice_firmright(id)             //8             case 7: dodvoice_tankahead(id)             //9             case 8: dodvoice_medic(id)             //0             case 9: return PLUGIN_HANDLED             }         }     return PLUGIN_HANDLED } public MenuChoice2(id, key) {     if(is_user_connected(id) && is_user_alive(id) && !is_user_bot(id) && !is_user_hltv(id) && (get_user_team(id) == 1 || get_user_team(id) == 2) && get_pcvar_num(p_voicemenus) == 1)         {           switch (key)             {             //1             case 0: dodvoice_prepare(id)             //2             case 1: {                 if(get_user_team(id) == 1 && dod_get_map_info(MI_ALLIES_TEAM) == 1)                     dodvoice_defobj(id)                 else                     return PLUGIN_CONTINUE                 }             //3             case 2: {                 if(get_user_team(id) == 1 && dod_get_map_info(MI_ALLIES_TEAM) == 1)                     dodvoice_defpos(id)                 else                     return PLUGIN_CONTINUE                 }             //4             case 3: {                 if(get_user_team(id) == 1 && dod_get_map_info(MI_ALLIES_TEAM) == 1)                     dodvoice_takeobj(id)                 else                     return PLUGIN_CONTINUE                 }             //5             case 4: {                 if(get_user_team(id) == 1 && dod_get_map_info(MI_ALLIES_TEAM) == 1)                     dodvoice_moveuppiat(id)                 else                     return PLUGIN_CONTINUE                 }             //6             case 5: return PLUGIN_CONTINUE             //7             case 6: return PLUGIN_CONTINUE             //8             case 7: return PLUGIN_CONTINUE             //9             case 8: return PLUGIN_CONTINUE             //0             case 9: return PLUGIN_HANDLED             }         }     return PLUGIN_HANDLED }

is there something i have wrong for it to do the 2nd menu properly? should i be doing it as 2 seperate menu positions on the same menu? i kind of thought having both menu's named differently and both having seperate register_menucmd thingys would make them both work.. guess not so far lol
__________________

Last edited by diamond-optic; 07-13-2006 at 22:21.
diamond-optic is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-13-2006 , 22:34   Re: 2 menus, 2nd one calls 1st menus functions?
Reply With Quote #2

I've never been able to find a workaround for this-- try using the new menu system, it's probably better anyway since your menus aren't very dynamic.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
GHW_Chronic
SourceMod Donor
Join Date: Sep 2004
Location: Texas
Old 07-13-2006 , 23:45   Re: 2 menus, 2nd one calls 1st menus functions?
Reply With Quote #3

the problem is your menu names.
dod_extra_voice_menu
+
dod_extra_voice_menu2

I found that there is a problem with just adding numbers onto the end. Change the menu names to:

dod_extra_voice_menu
+
second_dod_extra_voice_menu
GHW_Chronic is offline
Send a message via AIM to GHW_Chronic
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 07-14-2006 , 00:19   Re: 2 menus, 2nd one calls 1st menus functions?
Reply With Quote #4

Quote:
Originally Posted by GHW_Chronic
I found that there is a problem with just adding numbers onto the end.
Likewise *nods*

on a side note:
With the menu keys, I perfer doing this
Code:
#define MENU_KEY_1        (1<<0) #define MENU_KEY_2        (1<<1) #define MENU_KEY_3        (1<<2) #define MENU_KEY_4        (1<<3) #define MENU_KEY_5        (1<<4) #define MENU_KEY_6        (1<<5) #define MENU_KEY_7        (1<<6) #define MENU_KEY_8        (1<<7) #define MENU_KEY_9        (1<<8) #define MENU_KEY_0        (1<<9)
and then doing
Code:
 key = MENU_KEY_0|MENU_KEY_1
Cleaner IMHO.
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 07-14-2006 , 01:02   Re: 2 menus, 2nd one calls 1st menus functions?
Reply With Quote #5

why would you define them twice?

they are already defined in amxconst.inc for you.

but thats a scripters preference on whether to use them or not.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
diamond-optic
Veteran Member
Join Date: May 2005
Old 07-14-2006 , 21:03   Re: 2 menus, 2nd one calls 1st menus functions?
Reply With Quote #6

thanks guys.. i ended up just doing it thru 2 positions on the same menu & it works fine now
__________________
diamond-optic is offline
Reply


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 08:00.


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