Added register_native
This commit is contained in:
parent
0086b58f39
commit
0a4133b4d0
@ -271,3 +271,13 @@ enum {
|
||||
#define ITEM_ENABLED 1
|
||||
#define ITEM_DISABLED 2
|
||||
|
||||
#define AMX_ERR_NATIVE 10
|
||||
#define AMX_ERR_MEMACCESS 5
|
||||
#define AMX_ERR_NONE 0
|
||||
#define AMX_ERR_BOUNDS 4
|
||||
#define AMX_ERR_STACKERR 3
|
||||
#define AMX_ERR_STACKLOW 7
|
||||
#define AMX_ERR_HEAPLOW 8
|
||||
#define AMX_ERR_DIVIDE 11
|
||||
#define AMX_ERR_NOTFOUND 19
|
||||
#define AMX_ERR_PARAMS 25
|
||||
|
@ -212,6 +212,9 @@ native get_user_deaths(index);
|
||||
/* Sets player deaths. */
|
||||
native set_user_deaths(index, newdeaths);
|
||||
|
||||
/* Sets player frags. */
|
||||
native set_user_frags(index, frags);
|
||||
|
||||
/* Returns player health. */
|
||||
native get_user_health(index);
|
||||
|
||||
@ -516,9 +519,6 @@ native emit_sound(index, channel, sample[], Float:vol, Float:att,flags, pitch);
|
||||
/* Returns distance between two vectors. */
|
||||
native get_distance(origin1[3],origin2[3]);
|
||||
|
||||
/* Floating point version */
|
||||
native Float:get_distance_f(Float:origin1[3], Float:origin2[3]);
|
||||
|
||||
/* Registers new cvar for HL engine. */
|
||||
native register_cvar(const name[],const string[],flags = 0,Float:fvalue = 0.0);
|
||||
|
||||
@ -666,10 +666,8 @@ native md5(const szString[], md5buffer[34]);
|
||||
/* Calculates the md5 keysum of a file */
|
||||
native md5_file(const file[], md5buffer[34]);
|
||||
|
||||
/* Returns the internal flags set on the called plugin's state
|
||||
* If hdr is 1, it will return the pcode flags rather than state flags.
|
||||
*/
|
||||
native plugin_flags(hdr=0);
|
||||
/* Returns the internal flags set on the called bytecode structure - Do not use */
|
||||
native plugin_flags();
|
||||
|
||||
/* When using modules that aren't part of AMX Mod X base package, do
|
||||
* a require_module("modulename") for each of them within the plugin_modules()
|
||||
@ -684,46 +682,60 @@ native is_amd64_server();
|
||||
/* Returns 0 on success, like the POSIX specification */
|
||||
native mkdir(const dirname[]);
|
||||
|
||||
/* Returns plugin id searched by file/name. Returns INVALID_PLUGIN_ID on failure. */
|
||||
native find_plugin_byfile(const filename[], ignoreCase=1);
|
||||
/* This is called before plugin_init and allows you to register natives. */
|
||||
forward plugin_natives();
|
||||
|
||||
/** 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(title[], handler[], ml=0);
|
||||
/* Registers a NATIVE. When a plugin uses your native (you should distribute a .inc),
|
||||
* the handler will be called with two parameters: the calling plugin id, and the
|
||||
* number of parameters.
|
||||
* If you set style=1, the method of parameter passing is a tad more efficient.
|
||||
* Instead of "id, numParams", you label the native exactly as how the parameters
|
||||
* should, in theory, be sent. Then for each byreference parameter, you call
|
||||
* param_convert(num). This is theoretically more efficient but quite hacky.
|
||||
* The method was discovered by dJeyL, props to him!
|
||||
*/
|
||||
native register_native(const name[], const handler[], style=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(function[]);
|
||||
/* Registers a library. You can put #pragma library <name> in your include files,
|
||||
* and plugins that use your include without loading your plugin will get a nice
|
||||
* error message.
|
||||
*/
|
||||
native register_library(const library[]);
|
||||
|
||||
//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);
|
||||
/* Logs an error in your native, and breaks into the debugger.
|
||||
* Acts as if the calling plugin had the error.
|
||||
*/
|
||||
native log_error(error, const fmt[], ...);
|
||||
|
||||
//returns how many pages are in a menu
|
||||
native menu_pages(menu);
|
||||
// More Dynamic Native System Stuff
|
||||
// Each of these natives affects one of the parameters sent to your native.
|
||||
// Parameters go from 1 to n, just like in modules, and it is important to
|
||||
// remember two things: The parameters are actually coming from another plugin
|
||||
// (and just like modules, you must use these special natives).
|
||||
// two: you CANNOT call your native from inside your native. This is very bad.
|
||||
|
||||
//returns how many items are in a menu
|
||||
native menu_items(menu);
|
||||
// This function should only be called if you registered with style=1
|
||||
native param_convert(num);
|
||||
|
||||
//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);
|
||||
// Gets a string from the calling plugin
|
||||
native get_string(param, dest[], maxlen);
|
||||
|
||||
//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);
|
||||
// Sets a string in the calling plugin
|
||||
native set_string(param, dest[], maxlen);
|
||||
|
||||
//Gets/sets info about a menu option
|
||||
native menu_item_getinfo(menu, item, &access, command[], cmdlen, name[]="", namelen=0, &callback);
|
||||
// Gets a normal int or float parameter
|
||||
native get_param(param);
|
||||
native Float:get_param_f(param);
|
||||
|
||||
native menu_item_setname(menu, item, name[]);
|
||||
native menu_item_setcmd(menu, item, cmd[]);
|
||||
native menu_item_setcall(menu, item, callback=-1);
|
||||
// Gets/Sets a float or int parameter by reference
|
||||
native get_param_byref(param);
|
||||
native Float:get_float_byref(param);
|
||||
native set_param_byref(param, value);
|
||||
native set_float_byref(param, Float:value);
|
||||
|
||||
// Copies an array either from the calling plugin to you
|
||||
// Or copies an array from you to the calling plugin
|
||||
native get_array(param, dest[], size);
|
||||
native get_array_f(param, Float:dest[], size);
|
||||
native set_array(param, source[], size);
|
||||
native set_array_f(param, Float:source[], size);
|
Loading…
Reference in New Issue
Block a user