AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   callback to the selected menu item (https://forums.alliedmods.net/showthread.php?t=154466)

EclipseCP 04-09-2011 02:03

callback to the selected menu item
 
hi, sorry for my bad english :cry:

a question, how do I make it look all gray (disabled) using callback, an option to select from a menu (again)

PHP Code:

show_menu_admin(id)
{
    new 
menu[128], menuid
    
    
// Title
    
formatex(menucharsmax(menu), "Menu admin" 
    
menuid menu_create(menu"menu_admin")
    
    
formatex(menucharsmax(menu), "test 1")
    
menu_additem(menuidmenu"1")
    
    
formatex(menucharsmax(menu), "test2")
    
menu_additem(menuidmenu"2")
    
    
formatex(menucharsmax(menu), "test3")
    
menu_additem(menuidmenu"3")
    
    
formatex(menucharsmax(menu), "%L"id"BACK")
    
menu_setprop(menuidMPROP_EXITNAMEmenu)
    
    
menu_display(idmenuid)
}

public 
menu_admin(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_chat"hello1")
        case 
2client_print(idprint_chat"hello2")
        case 
3client_print(idprint_chat"hello3")
    }
    
    
menu_destroy(menuid)
    
    return 
PLUGIN_HANDLED;


grettings!!

Exolent[jNr] 04-09-2011 02:55

Re: callback to the selected menu item
 
http://forums.alliedmods.net/showpos...0&postcount=95

ConnorMcLeod 04-09-2011 07:21

Re: callback to the selected menu item
 
format the text starting with \d and instead of additem, use addtext.

Exolent[jNr] 04-09-2011 15:37

Re: callback to the selected menu item
 
Quote:

Originally Posted by ConnorMcLeod (Post 1446433)
format the text starting with \d and instead of additem, use addtext.

Just a note: You cannot do that with the first item of a menu because menu_addtext() will not work until there is at least 1 item in the menu.


All times are GMT -4. The time now is 20:07.

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