AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HELP with menu (https://forums.alliedmods.net/showthread.php?t=221511)

risontek22 07-23-2013 03:51

HELP with menu
 
hi i have made this, but the menu doesnt show. Help pls

PHP Code:


new const MAPS[][]        = {
    
"de_dust2",
    
"de_dust",
    
"de_aztec",
    
"de_nuke",
    
"de_inferno",
    
"de_italy"
}

public 
cmd_select_map(id)
{
    new 
mmenu menu_create("\rZmenit mapu","cmd_select_map_handler")

    for(new 
i<=  sizeof(MAPS); i++)
    {
        
menu_additem(mmenu,MAPS[i])
    }
    
    
menu_additem(mmenu,"\rZavriet")
    
    
menu_setprop(mmenu,MPROP_PERPAGE,0)
    
menu_setprop(mmenu,MPROP_NUMBER_COLOR,"\y")
    
    
menu_display(id,mmenu)
}

public 
cmd_select_map_handler(id,menu,item)
{
    if(
item == (sizeof(MAPS)+1))
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    if(!
admin[id])
        return 
PLUGIN_HANDLED

    server_cmd
("amx_map %s",MAPS[item])    
        
    return 
PLUGIN_HANDLED



Blizzard_87 07-23-2013 04:39

Re: HELP with menu
 
menu_setprop(mmenu,MPROP_PERPAGE,0)

Take that out

The way you have it your telling the menu to only show 0 items per page.

risontek22 07-23-2013 05:40

Re: HELP with menu
 
Not showing again...

PHP Code:

public cmd_select_map(id)
{
    new 
mmenu menu_create("\rZmenit mapu","cmd_select_map_handler")

    for(new 
i<=  sizeof(MAPS); i++)
    {
        
menu_additem(mmenu,MAPS[i])
    }
    
    
menu_setprop(mmenu,MPROP_NUMBER_COLOR,"\y")
    
    
menu_display(id,mmenu)
}

public 
cmd_select_map_handler(id,menu,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    if(!
admin[id])
        return 
PLUGIN_HANDLED

    server_cmd
("amx_map %s",MAPS[item])    
        
    return 
PLUGIN_HANDLED



akcaliberg 07-23-2013 11:25

Re: HELP with menu
 
be sure that the admin[id] is true

Blizzard_87 07-24-2013 06:49

Re: HELP with menu
 
Code:
for(new i; i <=  sizeof(MAPS); i++)

->

Code:
for( new i = 0; i < sizeof( MAPS ); i++ )


All times are GMT -4. The time now is 06:22.

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