Fixed bug am48234

This commit is contained in:
David Anderson 2006-12-19 02:24:09 +00:00
parent b762174c30
commit d6ed1a8d8a
2 changed files with 54 additions and 5 deletions

View File

@ -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<<option);
}
option_display = ++option;
if (option_display == 10)
{
option_display = 0;
}
if (enabled)
{
keys |= (1<<option);
if (m_AutoColors)
{
_snprintf(buffer, sizeof(buffer)-1, "\\r%d.\\w %s\n", ++option, pItem->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++;

View File

@ -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
}
}
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
}