Raised This Month: $ Target: $400
 0% 

Menu + Undermenus not working!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Timoses
Member
Join Date: Mar 2006
Location: Germany, NRW
Old 03-27-2006 , 12:12   Menu + Undermenus not working!
Reply With Quote #1

Ok I'm trying to make a menu which you can call up at a certain point
of the map.
So far it worked out when I put commands for the first menu.
But now I am trying to make undermenus ("Songs","Sound effects")
and if I want to access songs or sound effects with keynumbers 1 or 2
I end up at the code guessing again (the number 1 or 2 from choosing
songs, soundeffects is already there as the first digit for the code)

Here is what I got:
Code:
public plugin_init() {     register_clcmd("say /login","tv_bar_guess")     register_menucmd(register_menuid("Bar TV"), 1023,"action_bar_guess")     register_menucmd(register_menuid("Bar TV Menu"),1023,"action_bar_menu")     register_menucmd(register_menuid("Bar Music"),1023,"action_bar_music")     register_menucmd(register_menuid("Bar Sound"),1023,"action_bar_sound_effects") } public tv_bar_guess(id) {     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) <= 25.0)     {         new body[256]         new key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)         new len = format(body,sizeof(body),"Bar TV^n")         len += format(body[len],sizeof(body)-len,"---------------------------------------^n")         len += format(body[len],sizeof(body)-len,"              .%i.%i.%i.%i.%i.        ^n",bar_guesscode[id][0],bar_guesscode[id][1],bar_guesscode[id][2],bar_guesscode[id][3],bar_guesscode[id][4])         len += format(body[len],sizeof(body)-len,"---------------------------------------^n")         add(body,sizeof(body),"^n0. Exit^n")         show_menu(id,key,body)     }     else     {         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public action_bar_guess(id,key) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     new origin[3]     get_user_origin(id,origin)     if(get_distance(origin,bar_tv) > 25.0) return PLUGIN_HANDLED     if(key == 9) return PLUGIN_HANDLED         for(new i = 0;i < 5;i++) {  // Search for the specific slot and set value         if(bar_guesscode[id][i] == 0) {         bar_guesscode[id][i] = key+1         break         }     }         if(bar_guesscode[id][4] != 0)   // If last number then show menu     {         if(bar_guesscode[id][0] == bar_rightpass[0] && bar_guesscode[id][1] == bar_rightpass[1] && bar_guesscode[id][2] == bar_rightpass[2] && bar_guesscode[id][3] == bar_rightpass[3] && bar_guesscode[id][4] == bar_rightpass[4]) bar_menu(id)         else {             for(new i = 0;i < 5;i++) {             bar_guesscode[id][i] = 0             }         }         return PLUGIN_HANDLED     }     else                // If NOT last then reshow menu     {         tv_bar_guess(id)         return PLUGIN_HANDLED     }     return PLUGIN_HANDLED } public bar_menu(id) {     if(!is_user_alive(id)) return PLUGIN_HANDLED     client_print(id,print_chat,"[TV] Correct Code!")     for(new i = 0;i < 5;i++) {         bar_guesscode[id][i] = 0     }         new body[256]     new key = (1<<0)|(1<<1)|(1<<9)     new len = format(body,sizeof(body),"Bar TV Menu^n")         add(body,sizeof(body),"^n1. Songs^n")     add(body,sizeof(body),"2. Sound Effects^n")     add(body,sizeof(body),"^n^n0. Close Menu^n")     show_menu(id,key,body)     return PLUGIN_HANDLED } public action_bar_menu(id,key) {     if(key == 0) bar_music(id)     if(key == 1) bar_sound_effects(id)     if(key == 9) return PLUGIN_HANDLED     return PLUGIN_HANDLED } public bar_music(id) {     if(!is_user_alive(id)) return PLUGIN_HANDLED         new body[1024]     new key         format(body, 1023, "^nMusic Player^n^n1. Song1^n^n0. Close Menu^n")     key = (1<<0)|(1<<9)         show_menu(id,key,body)     return PLUGIN_HANDLED } public action_bar_music(id,key) {     switch(key)     {         case 0:         {             if(playing != 0)             {                 client_print(id,print_chat,"[TV] A song is already being played, wait for it to end!^n")                 return PLUGIN_HANDLED             }             else             {                 new box = create_entity("info_target")                 entity_set_origin( box, porigin)                 emit_sound(box, CHAN_AUTO, "Pimplordz/Music/song1.wav", 1.0, ATTN_IDLE, 0, PITCH_NORM)                 playing = 1                 set_task(300.0, "stop_player")                 client_print(id,print_chat,"[TV] Music is being played!^n")             }         }         case 1:         {             return PLUGIN_HANDLED         }     }     return PLUGIN_HANDLED } public bar_sound_effects(id) {     if(!is_user_alive(id)) return PLUGIN_HANDLED            new body[256]     new key         format(body, 1023, "^nSound Effects^n^n1. E-Bass^n^n0. Close Menu^n")     key = (1<<0)|(1<<9)         show_menu(id,key,body)     return PLUGIN_HANDLED } public action_bar_sound_effects(id,key) {     switch(key)     {         case 0:         {             new box = create_entity("info_target")             entity_set_origin( box, porigin)             emit_sound(box, CHAN_AUTO, "Pimplordz/Sound/Bass001.wav", 1.0, ATTN_STATIC, 0, PITCH_NORM)         }         case 1:         {             return PLUGIN_HANDLED         }     }     return PLUGIN_HANDLED }

Hope you guys can help me :s
Timoses is offline
Send a message via ICQ to Timoses Send a message via MSN to Timoses
 


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 16:45.


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