The bad thing about using menu_additem() is that it registers the key and therefore the menu will call the handler when that key is pressed.
So, my solution to use menu_addtext(menu,"\d3. Text Here",1) should theoretically work but it seems that the "new menus" system is flawed when using menu_addtext(). So, unfortunately this will not work.
Using the "old" menu system might be best in this situation.
I have another idea that might "work." brb
UPDATE:
Ok, so I think I found the best work-around:
PHP Code:
public TestMenu(id)
{
new Menu = menu_create("\yTest Menu", "test_show")
// g_bool = get_pcvar_num(p_test)
menu_additem(Menu, "\wTest 1", "1", 0)
menu_additem(Menu, "\wTest 2", "2", 0)
if( g_bool )
{
menu_additem(Menu, "\dTest 3", "99")
}
else
{
menu_additem(Menu, "\wTest 3", "3", 0)
}
menu_additem(Menu, "\wTest 4", "4", 0)
menu_additem(Menu, "\wTest 5", "5", 0)
menu_additem(Menu, "\wTest 6", "6", 0)
menu_additem(Menu, "\wTest 7", "7", 0)
menu_additem(Menu, "\wTest 8", "8", 0)
menu_additem(Menu, "\wTest 9", "9", 0)
menu_additem(Menu, "\wTest 10", "10", 0)
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
menu_setprop(Menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, Menu, 0)
return PLUGIN_HANDLED
}
public test_show(id, Menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(Menu)
return PLUGIN_HANDLED
}
new szData[6]
new iAccess
new iCallback
new szName[64]
menu_item_getinfo(Menu, item, iAccess, szData, 5, szName, 63, iCallback)
new iData = str_to_num(szData)
switch(iData)
{
case 1..10:
{
// Client selected valid item.
client_print(id, print_chat, "test %d", iData)
}
case 99:
{
// "id" selected disabled item.
TestMenu(id) // Re-display the menu to emulate "not being able to select that option." Unfortunately will only work well on page 0.
}
}
menu_destroy(Menu)
return PLUGIN_HANDLED
}
Remember to destroy the menu at the end of the function. Also, the "i" prefix if for integers. Use "sz" for strings, I have changed them above accordingly, take a look.
__________________