pedido doble comando en un menu
#1
buenas si alguien me puede hacer un menu que tenga en la opcion 1 un doble comando osea que en el primero diga top1 al precionarlo abre el motd del top bien y cuando vuelvan a abrir el menu en vez de decir top1 diga top2
Responder
#2
Hay varias formas de hacerlo, pero te dejo esta.

Código PHP:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new const szTops[][] = { "Top 1""Top2" }

new 
g_OptionCount[33]

public 
client_putinserver(id)
{
    
g_OptionCount[id] = 0
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""ShowMenu")
}

public 
ShowMenu(id)
{
    new 
menu
    menu 
menu_create("Tops""CmdMenu")

    
menu_additem(menuszTops[g_OptionCount[id]])
    
    
menu_display(idmenu)
}

public 
CmdMenu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED;
    }
    
    switch(
item)
    {
        case 
0:
        {    
            
motd_top(id)
            
            
g_OptionCount[id]++
            
            if(
g_OptionCount[id] >= sizeof szTops)
                
g_OptionCount[id] = 0
        
}
    }
    
    return 
PLUGIN_HANDLED;
}

public 
motd_top(id)
{
    if(
g_OptionCount[id] == 0)
        
client_print(0print_chat"Prueba: este es el motd 1")
    else if(
g_OptionCount[id] == 1)
        
client_print(0print_chat"Prueba: este es el motd 2")

[Imagen: 76561198068808877.png]
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)