Restringir un menú hasta llegar a " x " cosas.
#1
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.
Responder
#2
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(PLUGINVERSIONAUTHOR);
    
    
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(idprint_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(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
hand_menu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    switch (
item)
    {
        case 
0client_print(idprint_chat"Selecciono la opcion 1");
        case 
1client_print(idprint_chat"Selecciono la opcion 2");
        case 
2client_print(idprint_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.
Responder
#3
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(PLUGINVERSIONAUTHOR);
    
    
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(idprint_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(idmenu0);
    return 
PLUGIN_HANDLED;
}

public 
hand_menu(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    switch (
item)
    {
        case 
0client_print(idprint_chat"Selecciono la opcion 1");
        case 
1client_print(idprint_chat"Selecciono la opcion 2");
        case 
2client_print(idprint_chat"Selecciono la opcion 3");
    }
    return 
PLUGIN_HANDLED;

Algo así ?
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)