Newmenus: Add necessary API changes for newmenu timeouts
This commit is contained in:
parent
c8b7a09028
commit
3b87c428dc
@ -825,8 +825,14 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
|
||||
}
|
||||
}
|
||||
|
||||
// This will set the expire time of the menu to infinite
|
||||
pPlayer->menuexpire = INFINITE;
|
||||
int time = -1;
|
||||
if (params[0] / sizeof(cell) >= 4)
|
||||
time = params[4];
|
||||
|
||||
if (time < 0)
|
||||
pPlayer->menuexpire = INFINITE;
|
||||
else
|
||||
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
|
||||
|
||||
return pMenu->Display(player, page);
|
||||
}
|
||||
|
@ -269,9 +269,10 @@ enum {
|
||||
|
||||
#define INVALID_PLUGIN_ID -1
|
||||
|
||||
#define MENU_EXIT -3
|
||||
#define MENU_BACK -2
|
||||
#define MENU_MORE -1
|
||||
#define MENU_TIMEOUT -4
|
||||
#define MENU_EXIT -3
|
||||
#define MENU_BACK -2
|
||||
#define MENU_MORE -1
|
||||
#define ITEM_IGNORE 0
|
||||
#define ITEM_ENABLED 1
|
||||
#define ITEM_DISABLED 2
|
||||
|
@ -111,13 +111,20 @@ native menu_items(menu);
|
||||
* when the item is less than 0 (i.e. calling this from a cancelled menu will
|
||||
* result in an error).
|
||||
*
|
||||
* Starting with 1.8.3 this allows to select a menu timeout similar to the
|
||||
* show_menu native. If the menu exists on the client past the timeout *any*
|
||||
* further action will send the MENU_TIMEOUT status code to the menu handler.
|
||||
* That includes actions which would otherwise send MENU_EXIT, including
|
||||
* client disconnect and calling menu_cancel or menu_destroy on a live menu.
|
||||
*
|
||||
* @param id Client index.
|
||||
* @param menu Menu resource identifier.
|
||||
* @param page Page to start from (starting from 0).
|
||||
* @param time If >=0 menu will timeout after this many seconds
|
||||
* @noreturn
|
||||
* @error Invalid menu resource or client index.
|
||||
*/
|
||||
native menu_display(id, menu, page=0);
|
||||
native menu_display(id, menu, page=0, time=-1);
|
||||
|
||||
/**
|
||||
* Given a page on a menu and a keypress on that page, returns the item id selected.
|
||||
|
Loading…
Reference in New Issue
Block a user