Add MPROP_SHOWPAGE (#473)
This commit is contained in:
parent
fba3d706fc
commit
98ab26671c
@ -92,7 +92,7 @@ bool CloseNewMenus(CPlayer *pPlayer)
|
||||
|
||||
Menu::Menu(const char *title, AMX *amx, int fid) : m_Title(title), m_ItemColor("\\r"),
|
||||
m_NeverExit(false), m_AutoColors(g_coloredmenus), thisId(0), func(fid),
|
||||
isDestroying(false), pageCallback(-1), items_per_page(7)
|
||||
isDestroying(false), pageCallback(-1), showPageNumber(true), items_per_page(7)
|
||||
{
|
||||
CPluginMngr::CPlugin *pPlugin = g_plugins.findPluginFast(amx);
|
||||
menuId = g_menucmds.registerMenuId(title, amx);
|
||||
@ -357,7 +357,7 @@ const char *Menu::GetTextString(int player, page_t page, int &keys)
|
||||
m_Text = nullptr;
|
||||
|
||||
char buffer[255];
|
||||
if (items_per_page && (pages != 1))
|
||||
if (showPageNumber && items_per_page && (pages != 1))
|
||||
{
|
||||
if (m_AutoColors)
|
||||
ke::SafeSprintf(buffer, sizeof(buffer), "\\y%s %d/%d\n\\w\n", m_Title.chars(), page + 1, pages);
|
||||
@ -983,6 +983,11 @@ static cell AMX_NATIVE_CALL menu_setprop(AMX *amx, cell *params)
|
||||
unregisterSPForward(pMenu->pageCallback);
|
||||
pMenu->pageCallback = callback;
|
||||
|
||||
break;
|
||||
}
|
||||
case MPROP_SHOWPAGE:
|
||||
{
|
||||
pMenu->showPageNumber = (get_amxaddr(amx, params[3]) != 0);
|
||||
break;
|
||||
}
|
||||
case MPROP_SET_NUMBER_COLOR:
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define MPROP_PADMENU 9
|
||||
#define MPROP_SET_NUMBER_COLOR 10
|
||||
#define MPROP_PAGE_CALLBACK 11
|
||||
#define MPROP_SHOWPAGE 12
|
||||
|
||||
typedef int (*MENUITEM_CALLBACK)(int, int, int);
|
||||
|
||||
@ -125,6 +126,7 @@ public:
|
||||
int func;
|
||||
bool isDestroying;
|
||||
int pageCallback;
|
||||
bool showPageNumber;
|
||||
public:
|
||||
unsigned int items_per_page;
|
||||
};
|
||||
|
@ -81,6 +81,11 @@
|
||||
*/
|
||||
#define MPROP_PAGE_CALLBACK 11
|
||||
|
||||
/**
|
||||
* Whether to show the page number in menu title (param1 = bool, true = default)
|
||||
*/
|
||||
#define MPROP_SHOWPAGE 12
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user