Mensajes: 225
Temas: 80
Registro en: Feb 2019
Reputación:
0
Alguien podría dejarme un menú restringido por cual sea la variable que elijan, es para un zombie plague.
Nives / Reset / GrandReset
Me basta que sea cualquier menú, para tomarlo de ejemplo e implementarlo.
Mensajes: 1,040
Temas: 89
Registro en: Jun 2015
Reputación:
21
Código PHP: #include <amxmodx>
#define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Author"
new g_nivel[33]; new g_reset[33]; new g_gran_reset[33];
#define cantidad 2
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /menu", "show_menu_test"); }
public show_menu_test(id) { if (g_nivel[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x nivel mínimo no abrirá el menú if (g_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x reset mínimo no abrirá el menú if (g_gran_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x gran reset mínimo no abrirá el menú
if (g_nivel[id] < cantidad && g_reset[id] < cantidad && g_gran_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con todos los requisitos anteriores
if (g_nivel[id] < cantidad) // Si no cumple con x nivel mínimo no abrirá el menú con mensaje { client_print(id, print_chat, "No tienes el nivel minimo"); return PLUGIN_HANDLED; }
new menu = menu_create("Hola soy un menu", "hand_menu");
menu_additem(menu, "Opcion 1", "1"); menu_additem(menu, "Opcion 2", "2"); menu_additem(menu, "Opcion 3", "3");
menu_display(id, menu, 0); return PLUGIN_HANDLED; }
public hand_menu(id, menu, item) { if (item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } switch (item) { case 0: client_print(id, print_chat, "Selecciono la opcion 1"); case 1: client_print(id, print_chat, "Selecciono la opcion 2"); case 2: client_print(id, print_chat, "Selecciono la opcion 3"); } return PLUGIN_HANDLED; }
Algo así ?
“Quien te quiere en su vida, volverá a buscarte”
Qué frase más estúpida
Porque quien te quiere en su vida, jamás se iría.
Mensajes: 225
Temas: 80
Registro en: Feb 2019
Reputación:
0
Sii, gracias, lo voy a estar probando durante la tarde!
(16/02/2019, 08:07 AM)HK-416 escribió: Código PHP: #include <amxmodx>
#define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Author"
new g_nivel[33]; new g_reset[33]; new g_gran_reset[33];
#define cantidad 2
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR); register_clcmd("say /menu", "show_menu_test"); }
public show_menu_test(id) { if (g_nivel[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x nivel mínimo no abrirá el menú if (g_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x reset mínimo no abrirá el menú if (g_gran_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con x gran reset mínimo no abrirá el menú
if (g_nivel[id] < cantidad && g_reset[id] < cantidad && g_gran_reset[id] < cantidad) return PLUGIN_HANDLED; // Si no cumple con todos los requisitos anteriores
if (g_nivel[id] < cantidad) // Si no cumple con x nivel mínimo no abrirá el menú con mensaje { client_print(id, print_chat, "No tienes el nivel minimo"); return PLUGIN_HANDLED; }
new menu = menu_create("Hola soy un menu", "hand_menu");
menu_additem(menu, "Opcion 1", "1"); menu_additem(menu, "Opcion 2", "2"); menu_additem(menu, "Opcion 3", "3");
menu_display(id, menu, 0); return PLUGIN_HANDLED; }
public hand_menu(id, menu, item) { if (item == MENU_EXIT) { menu_destroy(menu); return PLUGIN_HANDLED; } switch (item) { case 0: client_print(id, print_chat, "Selecciono la opcion 1"); case 1: client_print(id, print_chat, "Selecciono la opcion 2"); case 2: client_print(id, print_chat, "Selecciono la opcion 3"); } return PLUGIN_HANDLED; }
Algo así ?
|