AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   not open my menu (https://forums.alliedmods.net/showthread.php?t=156957)

EclipseCP 05-14-2011 09:50

not open my menu
 
hello, sorry for my english, use translator..

i have a problem, not open my menu.

code:

PHP Code:


#define MAX_MODES 5

new const LANG_MODES[MAX_MODES][] =
{
    
"Dog",
    
"Cat",
    
"Parrot",
    
"Crab",
    
"etc"
}

public 
my_menu(id)
{
    new 
menu[128], number[8], menuidi
    
    formatex
(menucharsmax(menu), "\yTest")
    
    
menuid menu_create(menu"my_menu_handle"

    for (
0MAX_MODESi++)
    {    
        
formatex(menucharsmax(menu), "%s"LANG_MODES[i])
        
        
num_to_str(inumcharsmax(num))
        
        
menu_additem(menuidmenunum)
    }
    
    
// No exit
    
menu_setprop(menuidMPROP_EXITMEXIT_NEVER)
    
    
menu_display(idmenuid


public 
my_menu_handle(idmenuiditem)
{
    
// Menu was closed
    
if (item == MENU_EXIT)
    {
        
menu_destroy(menuid)
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
buffer[4], dummyitemid
    menu_item_getinfo
(menuiditemdummybuffercharsmax(buffer), __dummy)
    
    
itemid str_to_num(buffer)
    
    switch(
itemid)
    {
        case 
1client_print(idprint_center"Hello")
    }
    
    
menu_destroy(menuid)
    
    return 
PLUGIN_HANDLED;



drekes 05-14-2011 11:05

Re: not open my menu
 
Is that the full code ?

EclipseCP 05-14-2011 11:41

Re: not open my menu
 
Quote:

Originally Posted by drekes (Post 1469226)
Is that the full code ?

yes... also already solved

Now I have another problem, I have a callback, but that option becomes disabled :S

PHP Code:

public show_menu_admin_players(id)
{
    new 
menu[128], lang[32], info[32], num[8], buffer[128], menuidi
    
    formatex
(menucharsmax(menu), "\ytest")
    
    
menuid menu_create(menu"menu_admin_convert"

    for (
0sizeof(LANG_MODES); i++) 
    {
        if (
MAX_LIMIT[i] > g_admin_count[id][i]) 
            
formatex(infocharsmax(info), "\r[\w%d\r/\w%d\r]"MAX_LIMIT[i] - g_admin_count[id][i], MAX_LIMIT[i])
        else
            
formatex(infocharsmax(info), "\r[\y0\r/\w%d\r]"MAX_LIMIT[i])
        
        
formatex(menucharsmax(menu), "%s %s"LANG_MODES[i], info)
        
        
num_to_str(inumcharsmax(num))
        
        
buffer[0] = i
        buffer
[1] = 0
        menu_additem
(menuidmenunumADMIN_ALLmenu_makecallback("c_admin_players"))
    }
    
    
// Sin exit
    
menu_setprop(menuidMPROP_EXITMEXIT_NEVER)
    
    
menu_display(idmenuid



fysiks 05-14-2011 14:47

Re: not open my menu
 
Quote:

Originally Posted by drekes (Post 1469226)
Is that the full code ?

If that's the full code then that's why it doesn't work :)

Quote:

Originally Posted by EclipseCP (Post 1469239)
yes... also already solved

Now I have another problem, I have a callback, but that option becomes disabled :S

Show the full code. Also, you should not have menu_makecallback() in the loop. Do it outside of the loop and store the value in a variable and use that variable. I don't think this is the issue here but should be done nonetheless.

drekes 05-14-2011 16:25

Re: not open my menu
 
Quote:

Originally Posted by fysiks (Post 1469348)
If that's the full code then that's why it doesn't work :)

That's why i asked =)


All times are GMT -4. The time now is 04:24.

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