newmenu stuff is now in its own nice callback. yay

This commit is contained in:
David Anderson 2007-08-16 19:07:59 +00:00
parent 824ed30872
commit 8298158f08
2 changed files with 1 additions and 83 deletions

View File

@ -281,24 +281,6 @@ enum {
#define FORWARD_ONLY_NEW 2
#define FORWARD_ALL 3
#define MEXIT_ALL 1 /* (default) Menu will have an exit option */
#define MEXIT_NORMAL 0 /* Deprecated, has no effect */
#define MEXIT_NEVER -1 /* Menu will not have an exit option */
#define MENUPAD_NONE 0 /* Deprecated, not used */
#define MENUPAD_PAGE 1 /* Deprecated, not used */
#define MPROP_PERPAGE 1 //NUM - items per page. 0=no paginating, 7=default
#define MPROP_BACKNAME 2 //STRING - name of "back" button
#define MPROP_NEXTNAME 3 //STRING - name of "more" button
#define MPROP_EXITNAME 4 //STRING - name of "exit" button
#define MPROP_TITLE 5 //STRING - sets menu title
#define MPROP_EXIT 6 //NUM - sets how "Exit" appears on the menu
#define MPROP_ORDER 7 /* Deprecated, has no effect */
#define MPROP_NOCOLORS 8 //NUM - sets whether colors are not auto (0=default)
#define MPROP_PADMENU 9 /* Deprecated, has no effect */
#define MPROP_NUMBER_COLOR 10 //STRING - color indicator to use for the numbers. ("\r"=default)
#define SND_SPAWNING (1<<8) // we're spawing, used in some cases for ambients
#define SND_STOP (1<<5) // stop sound
#define SND_CHANGE_VOL (1<<6) // change sound vol

View File

@ -22,6 +22,7 @@
#include <vector>
#include <sorting>
#include <cellarray>
#include <newmenus>
/* Function is called just after server activation.
* Good place for configuration loading, commands and cvars registration. */
@ -797,71 +798,6 @@ native get_array_f(param, Float:dest[], size);
native set_array(param, const source[], size);
native set_array_f(param, const Float:source[], size);
/** The new menu natives */
//If you set ml to 1, everything will be preformatted
// with the multi-lingual system.
//NOTE: ml=1 currently is not enabled.
//handler[] will be called when someone presses a key on your menu
native menu_create(const title[], const handler[], ml=0);
//Creates a menu item callback handler.
//The callback handler is passed the playerid, menuid, and itemid.
//It can return either ITEM_IGNORE, ITEM_ENABLED, or ITEM_DISABLED.
native menu_makecallback(const function[]);
//Adds an item to a menu. When displayed, the name will be shown.
//If the player does not have the access it is disabled.
//If you set callback, the callback will be called before the item is printed on the screen.
//this lets you change it in real time depending on conditions.
native menu_additem(menu, const name[], const command[]="", paccess=0, callback=-1);
//returns how many pages are in a menu
native menu_pages(menu);
//returns how many items are in a menu
native menu_items(menu);
//displays a menu to a player
//page of the menu starts at 0. there are 7 items to a page.
//back/exit/next/more whatever are automatically added as needed.
//you cannot use this to show a menu to everyone at once!
native menu_display(id, menu, page);
//Given a page on a menu and a keypress on that page, returns the item id selected.
//if the item is less than 0, a special option was chosen (such as MENU_EXIT)
native menu_find_id(menu, page, key);
//Gets/sets info about a menu option
native menu_item_getinfo(menu, item, &access, command[], cmdlen, name[]="", namelen=0, &callback);
native menu_item_setname(menu, item, const name[]);
native menu_item_setcmd(menu, item, const cmd[]);
native menu_item_setcall(menu, item, callback=-1);
//Destroys a menu - invalidates the handle
//This is safe, as it will go through the players and make
// sure they don't have this menu set anymore.
native menu_destroy(menu);
//Gets info about a player's menu. Returns 1 if the player is viewing a menu.
//menu will be >0 for a valid oldmenu. newmenu will be != -1 for a valid newmenu.
//As of 1.77, there is an optional page parameter.
native player_menu_info(id, &menu, &newmenu, &menupage=0);
//adds a blank line to a menu.
//if slot is nonzero (default), the blank line will increase
//the numbering rather than just shifting down.
native menu_addblank(menu, slot=1);
//Sets a menu property. See amxconst.inc for various menu properties.
//The third value depends on the property
native menu_setprop(menu, prop, ...);
//Cancels a player's menu, effectively forcing the player to select MENU_EXIT
//The menu will still exist on their screen but any results are invalidated,
//and the callback is invoked.
native menu_cancel(player);
// Dispatches a client cvar query
// id: Player id
// cvar: cvar name