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
__________________