Senior Member
Join Date: Apr 2008
Location: Argentina, Buenos Aires
|
12-29-2009
, 16:59
[Zp] Ayuda Con Un Menu :(
|
#1
|
Bueno estaba haciendo esto[
http://forums.alliedmods.net/showpost.php?p=872788
Para poder agregarle el modo synapsis, armagedon, sniper etc.. al menu de los admines y me salto todo esto
[IMG]http://img85.**************/img85/60/aaaaaaaaaaaaaaaaaaaaaaag.png[/IMG]
Yo hice asi:
Abajo de:
PHP Code:
// 7. Plague mode command if (allowed_plague()) len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w %L^n", id, "MENU_ADMIN7") else len += formatex(menu[len], sizeof menu - 1 - len, "\d7. %L^n", id, "MENU_ADMIN7")[/code]Puse esto antes del 0
// 9. Next
len += formatex(menu[len], sizeof menu - 1 - len, "^n\r9.\y %L", id, "MENU_NEXT") [/code] Despues esta parte me quedo asi:
PHP Code:
case 6: // Plague Mode command { if (allowed_plague()) command_plague(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case MENU_KEY_NEXT: { show_menu_admin2(id) return PLUGIN_HANDLED; } } return PLUGIN_HANDLED; }
Esta parte me quedo asi:
PHP Code:
// Admin Menu show_menu_admin(id) { static menu[250], len len = 0 // Title len += formatex(menu[len], sizeof menu - 1 - len, "\y%L^n^n", id, "MENU_ADMIN_TITLE") // 1. Zombiefy/Humanize command if (!g_endround && !g_swarmround && !g_nemround && !g_survround && !g_plagueround && !task_exists(TASK_WELCOMEMSG)) len += formatex(menu[len], sizeof menu - 1 - len, "\r1.\w %L^n", id, "MENU_ADMIN1") else len += formatex(menu[len], sizeof menu - 1 - len, "\d1. %L^n", id, "MENU_ADMIN1") // 2. Nemesis command if (g_newround && !g_endround && get_pcvar_num(cvar_nem) && !task_exists(TASK_WELCOMEMSG)) len += formatex(menu[len], sizeof menu - 1 - len, "\r2.\w %L^n", id, "MENU_ADMIN2") else len += formatex(menu[len], sizeof menu - 1 - len, "\d2. %L^n", id, "MENU_ADMIN2") // 3. Survivor command if (g_newround && !g_endround && get_pcvar_num(cvar_surv) && !task_exists(TASK_WELCOMEMSG)) len += formatex(menu[len], sizeof menu - 1 - len, "\r3.\w %L^n", id, "MENU_ADMIN3") else len += formatex(menu[len], sizeof menu - 1 - len, "\d3. %L^n", id, "MENU_ADMIN3") // 4. Respawn command if (!g_endround && !g_survround && !g_swarmround && !g_nemround && !g_plagueround) len += formatex(menu[len], sizeof menu - 1 - len, "\r4.\w %L^n", id, "MENU_ADMIN4") else len += formatex(menu[len], sizeof menu - 1 - len, "\d4. %L^n", id, "MENU_ADMIN4") // 5. Swarm mode command if (allowed_swarm()) len += formatex(menu[len], sizeof menu - 1 - len, "\r5.\w %L^n", id, "MENU_ADMIN5") else len += formatex(menu[len], sizeof menu - 1 - len, "\d5. %L^n", id, "MENU_ADMIN5") // 6. Multi infection command if (allowed_multi()) len += formatex(menu[len], sizeof menu - 1 - len, "\r6.\w %L^n", id, "MENU_ADMIN6") else len += formatex(menu[len], sizeof menu - 1 - len, "\d6. %L^n", id, "MENU_ADMIN6") // 7. Plague mode command if (allowed_plague()) len += formatex(menu[len], sizeof menu - 1 - len, "\r7.\w %L^n", id, "MENU_ADMIN7") else len += formatex(menu[len], sizeof menu - 1 - len, "\d7. %L^n", id, "MENU_ADMIN7") // 9. Next len += formatex(menu[len], sizeof menu - 1 - len, "^n\r9.\y %L", id, "MENU_NEXT") // 0. Exit len += formatex(menu[len], sizeof menu - 1 - len, "^n\r0.\w %L", id, "MENU_EXIT") show_menu(id, KEYSMENU, menu, -1, "Admin Menu") }
public show_menu_admin2(id) // Creamos el name del public { // Creamos el titulo y el handle del menu new amenu = menu_create("Mas opciones de adm", "mostrar_menu") // Creamos las opciones que necesitemos (yo voy a poner solo 3) menu_additem(amenu, "Empesar modo Assassin, "1" ) menu_additem(amenu, "Empesar modo Armagedon", "2") menu_additem(amenu, "Empesar modo Nemesis", "3") menu_additem(amenu, "Empesar modo Survivor", "4") menu_additem(amenu, "Empesar modo Synapsis", "5") menu_additem(amenu, "Empesar modo Sniper", "6") menu_display(id, amenu, 0) return PLUGIN_HANDLED }
Y el menu asi:
PHP Code:
public show_menu_admin2(id) // Creamos el name del public { // Creamos el titulo y el handle del menu new amenu = menu_create("Mas opciones de adm", "mostrar_menu") // Creamos las opciones que necesitemos (yo voy a poner solo 3) menu_additem(amenu, "Empesar modo Assassin, "1" ) menu_additem(amenu, "Empesar modo Armagedon", "2") menu_additem(amenu, "Empesar modo Nemesis", "3") menu_additem(amenu, "Empesar modo Survivor", "4") menu_additem(amenu, "Empesar modo Synapsis", "5") menu_additem(amenu, "Empesar modo Sniper", "6") menu_display(id, amenu, 0) return PLUGIN_HANDLED }
Despues la otra parte del menu, me quedo asi:
PHP Code:
public mostrar_menu(id, menu, item) // Public { // El if para hacer la opcion de salir if(item == MENU_EXIT) return PLUGIN_HANDLED // Las variables que siempre usamos new data[6], iName[64], access, callback; menu_item_getinfo(menu, item, access, data,5, iName, 63, callback); // Switch para los case switch(str_to_num(data)) { // Agregamos nuestras opciones case 1: // Assassin { if (allowed_swarm()) command_assassin(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case 2: // Armagedon { if (allowed_swarm()) command_lnj(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case 3: // Nemesis { if (allowed_swarm()) command_nemmenu(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case 4: // Survivor { if (allowed_swarm()) command_survmenu(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case 5: // Synapsis { if (allowed_swarm()) command_synapsis(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } case 6: // Sniper { if (allowed_multi()) command_sniper(id) else zp_colored_print(id, "^x04[ZP]^x01 %L", id, "CMD_NOT") show_menu_admin(id) } // Si se dan cuenta el code de adentro de los case no cambio // en nada de lo que seria el code del menu original , porque es lo mismo } }
No se que hice mal u.u alguno me da una mano ?
Last edited by Tidius; 12-29-2009 at 17:04.
|
|