mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-26 14:55:36 +03:00
Newmenus: Add MEXIT_FORCE for proper exit button on non-paginated menus
This commit is contained in:
parent
7ae802d736
commit
ff18b03250
@ -560,27 +560,31 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
|||||||
/* Keep padding */
|
/* Keep padding */
|
||||||
option += 2;
|
option += 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_NeverExit)
|
if ((items_per_page && !m_NeverExit) || (m_ForceExit && numItems < 10))
|
||||||
|
{
|
||||||
|
/* Visual pad has not been added yet */
|
||||||
|
if (!items_per_page)
|
||||||
|
m_Text.append("\n");
|
||||||
|
|
||||||
|
keys |= (1<<option++);
|
||||||
|
if (m_AutoColors)
|
||||||
{
|
{
|
||||||
keys |= (1<<option++);
|
_snprintf(buffer,
|
||||||
if (m_AutoColors)
|
sizeof(buffer)-1,
|
||||||
{
|
"%s%d. \\w%s\n",
|
||||||
_snprintf(buffer,
|
m_ItemColor.c_str(),
|
||||||
sizeof(buffer)-1,
|
option == 10 ? 0 : option,
|
||||||
"%s%d. \\w%s\n",
|
m_OptNames[abs(MENU_EXIT)].c_str());
|
||||||
m_ItemColor.c_str(),
|
} else {
|
||||||
option == 10 ? 0 : option,
|
_snprintf(buffer,
|
||||||
m_OptNames[abs(MENU_EXIT)].c_str());
|
sizeof(buffer)-1,
|
||||||
} else {
|
"%d. %s\n",
|
||||||
_snprintf(buffer,
|
option == 10 ? 0 : option,
|
||||||
sizeof(buffer)-1,
|
m_OptNames[abs(MENU_EXIT)].c_str());
|
||||||
"%d. %s\n",
|
|
||||||
option == 10 ? 0 : option,
|
|
||||||
m_OptNames[abs(MENU_EXIT)].c_str());
|
|
||||||
}
|
|
||||||
m_Text.append(buffer);
|
|
||||||
}
|
}
|
||||||
|
m_Text.append(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_Text.c_str();
|
return m_Text.c_str();
|
||||||
@ -990,8 +994,13 @@ static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params)
|
|||||||
if (ans == 1 || ans == 0)
|
if (ans == 1 || ans == 0)
|
||||||
{
|
{
|
||||||
pMenu->m_NeverExit = false;
|
pMenu->m_NeverExit = false;
|
||||||
|
pMenu->m_ForceExit = false;
|
||||||
|
} else if (ans == 2) {
|
||||||
|
pMenu->m_NeverExit = false;
|
||||||
|
pMenu->m_ForceExit = true;
|
||||||
} else if (ans == -1) {
|
} else if (ans == -1) {
|
||||||
pMenu->m_NeverExit = true;
|
pMenu->m_NeverExit = true;
|
||||||
|
pMenu->m_ForceExit = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ public:
|
|||||||
|
|
||||||
String m_ItemColor;
|
String m_ItemColor;
|
||||||
bool m_NeverExit;
|
bool m_NeverExit;
|
||||||
|
bool m_ForceExit;
|
||||||
bool m_AutoColors;
|
bool m_AutoColors;
|
||||||
|
|
||||||
int menuId;
|
int menuId;
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
#define _newmenus_included
|
#define _newmenus_included
|
||||||
|
|
||||||
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
|
#define MEXIT_ALL 1 /* Menu will have an exit option (default)*/
|
||||||
|
#define MEXIT_FORCE 2 /* Menu will have an exit option, even when pagination is disabled.
|
||||||
|
* There have to be less than 10 items in the menu or it won't appear. The exit
|
||||||
|
* option will be appended to the last item with no extra slot padding. If you
|
||||||
|
* want it in the 10th slot you have to pad it manually with menu_addblank2 */
|
||||||
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
|
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
|
||||||
|
|
||||||
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
|
#define MPROP_PERPAGE 1 /* Number of items per page (param1 = number, 0=no paginating, 7=default) */
|
||||||
|
Loading…
Reference in New Issue
Block a user