diff --git a/extensions/topmenus/TopMenu.cpp b/extensions/topmenus/TopMenu.cpp index ee4f1eb5..ba5eabee 100644 --- a/extensions/topmenus/TopMenu.cpp +++ b/extensions/topmenus/TopMenu.cpp @@ -354,6 +354,10 @@ bool TopMenu::DisplayMenu(int client, unsigned int hold_time, TopMenuPosition po pClient->last_category < m_Categories.size()) { return_value = DisplayCategory(client, pClient->last_category, hold_time, true); + if (!return_value) + { + return_value = pClient->root->DisplayAtItem(client, hold_time, pClient->last_root_pos); + } } else if (position == TopMenuPosition_LastRoot) { @@ -424,7 +428,11 @@ void TopMenu::OnMenuSelect2(IBaseMenu *menu, int client, unsigned int item, unsi if (m_Categories[i]->obj == obj) { pClient->last_root_pos = item_on_page; - DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false); + if (!DisplayCategory(client, (unsigned int)i, MENU_TIME_FOREVER, false)) + { + /* If we can't display the category, re-display the root menu */ + DisplayMenu(client, MENU_TIME_FOREVER, TopMenuPosition_LastRoot); + } break; } } diff --git a/extensions/topmenus/extension.cpp b/extensions/topmenus/extension.cpp index 97401b2b..4ad67705 100644 --- a/extensions/topmenus/extension.cpp +++ b/extensions/topmenus/extension.cpp @@ -61,3 +61,4 @@ void TopMenuExtension::SDK_OnUnload() playerhelpers->RemoveClientListener(&g_TopMenus); plsys->RemovePluginsListener(&g_TopMenus); } + diff --git a/extensions/topmenus/smn_topmenus.cpp b/extensions/topmenus/smn_topmenus.cpp index 53733937..50146afb 100644 --- a/extensions/topmenus/smn_topmenus.cpp +++ b/extensions/topmenus/smn_topmenus.cpp @@ -85,7 +85,7 @@ public: m_pFunction->PushCell(TopMenuAction_DrawOption); m_pFunction->PushCell(object_id); m_pFunction->PushCell(client); - m_pFunction->PushStringEx(buffer, sizeof(buffer), 0, SM_PARAM_COPYBACK); + m_pFunction->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); m_pFunction->PushCell(sizeof(buffer)); m_pFunction->Execute(NULL); return (unsigned int)buffer[0]; diff --git a/plugins/adminmenu.sp b/plugins/adminmenu.sp index e9796622..eddcca1a 100644 --- a/plugins/adminmenu.sp +++ b/plugins/adminmenu.sp @@ -113,6 +113,7 @@ public CategoryHandler(Handle:topmenu, String:buffer[], maxlength) { + PrintToServer("CategoryHandler(%x, %d, %x)", topmenu, action, object_id); if (action == TopMenuAction_DisplayTitle) { if (object_id == INVALID_TOPMENUOBJECT) @@ -147,8 +148,6 @@ public CategoryHandler(Handle:topmenu, Format(buffer, maxlength, "%T", "Voting Commands", param); } } - - return 0; } public __GetAdminTopMenu(Handle:plugin, numParams)