AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   multimenu or submenu problem (https://forums.alliedmods.net/showthread.php?t=27013)

abrakdabra 04-13-2006 02:44

multimenu or submenu problem
 
Well, im doing a plugin that can manage commands from other plugins, by this time its all fine, the menu shows, but when i press a key, it doesnt go to the submenu, its like i was pressing the Exit key :S


(i talk spanish, im not form USA, and the plugin it its same part in spanish, so, guide by the names)
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #include <engine> #include <nvault> #include <core> #include <fakemeta> #define PLUGIN "Menu Plugins" #define VERSION "1.0" #define AUTHOR "AbraKdabra" public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR)     new keysMenuPrincipal = 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     new keysBunnyHop = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4     new keysCamara = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3     new keysGranadas = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3     new keysMoney = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     new keysJetPack = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     new keysLongJump = MENU_KEY_0|MENU_KEY_1     new keysSurfOlympics = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4     new keysKZMultiPlugin= MENU_KEY_0|MENU_KEY_1|MENU_KEY_2     register_clcmd( "menup", "mostrarMenuPrincipal")     register_menucmd( register_menuid("MenuPrincipal:"),    keysMenuPrincipal , "MenuPrincipal")     register_menucmd( register_menuid("MenuBunnyHop:"),     keysBunnyHop , "BunnyHop")     register_menucmd( register_menuid("MenuCamara:"),       keysCamara , "Camara")     register_menucmd( register_menuid("MenuGranadas:"),     keysGranadas , "Granadas")     register_menucmd( register_menuid("MenuMoney:"),        keysMoney , "Money")     register_menucmd( register_menuid("MenuJetPack:"),      keysJetPack , "JetPack")     register_menucmd( register_menuid("MenuLongJump:"),     keysLongJump , "LongJump")     register_menucmd( register_menuid("MenuSurfOlympìcs:"), keysSurfOlympics , "SurfOlympics")     register_menucmd( register_menuid("MenuKZ:"),            keysKZMultiPlugin , "KZMultiPlugin")     return PLUGIN_CONTINUE      } public mostrarMenuPrincipal(id) {     new menu[192]     new keysMenuPrincipal = 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         format (menu, 191, "Que Plugin quieres usar?^n^n1. BunnyHop^n2. Camara^n3. Granadas^n4. Money^n5. JetPack^n6. LongJump^n7. SurfOlympics^n8. KZ MultiPlugin^n^n0. Exit")     show_menu(id, keysMenuPrincipal, menu)     return PLUGIN_CONTINUE } public MenuBunnyHop(id) {     new menu[192]     new keysBunnyHop = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4         format(menu, 191, "Que comando queres ejecutar?^n^n1. bh_enable <1|0>^n2. bh_autojump <1|0>^n3. bh_showusage <1|0>^n^n0. Exit")     show_menu(id, keysBunnyHop, menu)     return PLUGIN_CONTINUE } public MenuCamara(id) {     new menu[192]     new keysCamara = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3         format(menu, 191, "Que comando queres ejecutar?^n^n1. amx_addcamera^n2. amx_viewcamera^n3. amx_deletecamera^n^n0. Exit")     show_menu(id, keysCamara, menu)     return PLUGIN_CONTINUE } public MenuGranadas(id) {     new menu[192]     new keysGranadas = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3         format(menu, 191, "Que comando queres ejecutar?^n^n1. mp_max_fb <#>^n2. mp_max_he <#>^n3. mp_max_sg <#>^n^n0. Exit")     show_menu(id, keysGranadas, menu)     return PLUGIN_CONTINUE } public MenuMoney(id) {     new menu[192]     new keysMoney = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2         format(menu, 191, "Que comando queres ejecutar?^n^n1. say /moneyme^n2. sv_money <1|0>^n^n0. Exit")     show_menu(id, keysMoney, menu)     return PLUGIN_CONTINUE } public MenuJetPack(id) {     new menu[192]     new keysJetPack = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2         format(menu, 191, "Que comando queres ejecutar?^n^n1. say /jetpack^n2. say /dropjp^n^n0. Exit")     show_menu(id, keysJetPack, menu)     return PLUGIN_CONTINUE } public MenuLongJump(id) {     new menu[192]     new keysLongJump = MENU_KEY_0|MENU_KEY_1         format(menu, 191, "Que comando queres ejecutar?^n^n1. sv_longjump <1|0>^n^n0. Exit")     show_menu(id, keysLongJump, menu)     return PLUGIN_CONTINUE } public MenuSurfOlympics(id) {     new menu[192]     new keysSurfOlympics = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4         format(menu, 191, "Que comando queres ejecutar?^n^n1. surf_teamstack <1|2|3>^n2. surf_godmode <1|0>^n3. /respawn^n4. /help^n^n0. Exit")     show_menu(id, keysSurfOlympics, menu)     return PLUGIN_CONTINUE } public MenuKZ(id) {     new menu[192]     new keysKZMultiPlugin= MENU_KEY_0|MENU_KEY_1|MENU_KEY_2         format(menu, 191, "Que comando queres ejecutar?^n^n1. /checkpoint^n2. /gocheck^n^n0. Exit")     show_menu(id, keysKZMultiPlugin, menu)     return PLUGIN_CONTINUE  }

the other thing i want to know, its how can i "call" by the submenu names, the commands of the other plugins...
example:

i have /checkpoint named in a submenu, how i have to put in the code, the /checkpoint command code?

abrakdabra 04-14-2006 12:07

Up, someone can help me? :P

hip_hop_x 04-14-2006 18:36

I belive i know how. The problem is you haven't created the submenu tasks. I will demonstrate how:
Code:
public MenuBunnyHop(id) {     new menu[192]     new keysBunnyHop = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4           format(menu, 191, "Que comando queres ejecutar?^n^n1. bh_enable <1|0>^n2. bh_autojump <1|0>^n3. bh_showusage <1|0>^n^n0. Exit")     show_menu(id, keysBunnyHop, menu)     return PLUGIN_CONTINUE } //My example public MenuBunnyHop(id, key)     //Here you will add your code     if (key == 0)     {          //This is an example          set_user_health(id, 120)      } }

abrakdabra 04-15-2006 02:09

nope, thats not the problem...

the MenuPrincipal (main menu in english :P) goes up (i see it), but when i press "key 1", or the BunnyHop Menu, nothing happens, the menu desappear, thats the problem, the main menu charge, but the submenu doesnt.

organizedKaoS 04-15-2006 06:27

One of the reasons could be that your missing "MenuPrincipal". Your main menu doesnt have the key actions defined for that menu. It has the command to bring up the menu, but after that, its basically just pretty hud messages showing on your screen. The menu exits because your not instructing the plugin what to do when a certain key is pressed. You have to make the public that calls the other menus when the corresponding button is pressed. :wink:

abrakdabra 04-15-2006 10:55

Quote:

Originally Posted by organizedKaoS
One of the reasons could be that your missing "MenuPrincipal". Your main menu doesnt have the key actions defined for that menu. It has the command to bring up the menu, but after that, its basically just pretty hud messages showing on your screen. The menu exits because your not instructing the plugin what to do when a certain key is pressed. You have to make the public that calls the other menus when the corresponding button is pressed. :wink:


could you give me an example? :D

hip_hop_x 04-15-2006 15:14

That's what i have explained you in there. You dont have the key actions defined for that menu.
If you haven't understanf from my examplme go here : http://wiki.amxmodx.org/index.php and search.


All times are GMT -4. The time now is 05:12.

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