diff --git a/amxmodx/newmenus.cpp b/amxmodx/newmenus.cpp index 78d3818b..aae722e0 100755 --- a/amxmodx/newmenus.cpp +++ b/amxmodx/newmenus.cpp @@ -343,13 +343,16 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) bool enabled = true; int ret = 0; int slots = 0; + int option_display = 0; for (item_t i = start; i <= end; i++) { pItem = m_Items[i]; if (pItem->access && !(pItem->access & g_players[player].flags[0])) + { enabled = false; + } if (pItem->handler != -1) { @@ -372,23 +375,33 @@ const char *Menu::GetTextString(int player, page_t page, int &keys) enabled = false; } } + + if (enabled) + { + keys |= (1<name.c_str()); + _snprintf(buffer, sizeof(buffer)-1, "\\r%d.\\w %s\n", option_display, pItem->name.c_str()); } else { - _snprintf(buffer, sizeof(buffer)-1, "%d. %s\n", ++option, pItem->name.c_str()); + _snprintf(buffer, sizeof(buffer)-1, "%d. %s\n", option_display, pItem->name.c_str()); } } else { if (m_AutoColors) { - _snprintf(buffer, sizeof(buffer)-1, "\\d%d. %s\n\\w", ++option, pItem->name.c_str()); + _snprintf(buffer, sizeof(buffer)-1, "\\d%d. %s\n\\w", option_display, pItem->name.c_str()); } else { _snprintf(buffer, sizeof(buffer)-1, "#. %s\n", pItem->name.c_str()); - option++; } } slots++; diff --git a/plugins/testsuite/menutest.sma b/plugins/testsuite/menutest.sma index 32be0b5a..787f10e9 100644 --- a/plugins/testsuite/menutest.sma +++ b/plugins/testsuite/menutest.sma @@ -7,6 +7,7 @@ public plugin_init() register_clcmd("menu_test1", "Test_Menu1") register_clcmd("menu_test2", "Test_Menu2") register_clcmd("menu_test3", "Test_Menu3") + register_clcmd("menu_test4", "Test_Menu4") } public Test_Menu1(id, level, cid) @@ -89,4 +90,39 @@ public Test_Menu3_Handler(id, menu, item) menu_destroy(menu) return PLUGIN_HANDLED -} \ No newline at end of file +} + +public Test_Menu4(id) +{ + new mHandleID = menu_create("Test Menu 4", "Test_Menu4_Handler") + menu_setprop(mHandleID, MPROP_PERPAGE, 0) + menu_additem(mHandleID, "test1", "1", 0) + menu_additem(mHandleID, "test2", "2", 0) + menu_additem(mHandleID, "test3", "3", 0) + menu_additem(mHandleID, "test4", "4", 0) + menu_additem(mHandleID, "test5", "5", 0) + menu_additem(mHandleID, "test6", "6", 0) + menu_additem(mHandleID, "test7", "7", 0) + menu_additem(mHandleID, "test8", "8", 0) + menu_additem(mHandleID, "test9", "9", 0) + menu_additem(mHandleID, "test10", "10", 0) + + menu_display(id, mHandleID, 0) + + return PLUGIN_HANDLED +} + +public Test_Menu4_Handler(id, menu, item) +{ + if (item == MENU_EXIT) + { + menu_destroy(menu) + return PLUGIN_HANDLED + } + + client_print(id, print_chat, "item = %d", item) + + menu_destroy(menu) + + return PLUGIN_HANDLED +}