[Half-Life AMXX] / include / amxmodx.inc Repository:
ViewVC logotype

Diff of /include/amxmodx.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 16, Fri Nov 16 15:12:40 2007 UTC revision 17, Fri Nov 16 15:29:57 2007 UTC
# Line 21  Line 21 
21  #include <messages>  #include <messages>
22  #include <vector>  #include <vector>
23  #include <sorting>  #include <sorting>
24    #include <cellarray>
25    #include <newmenus>
26    
27  /* Function is called just after server activation.  /* Function is called just after server activation.
28  * Good place for configuration loading, commands and cvars registration. */  * Good place for configuration loading, commands and cvars registration. */
# Line 97  Line 99 
99  native show_motd(player,const message[],const header[]="");  native show_motd(player,const message[],const header[]="");
100    
101  /* Sends message to player. Set index to 0 to send text globaly. */  /* Sends message to player. Set index to 0 to send text globaly. */
102  native client_print(index,type,const message[],{Float,Sql,Result,_}:...);  native client_print(index,type,const message[],any:...);
103    
104  /* Sends message to player by engine. Set index to 0 to send text globaly. */  /* Sends message to player by engine. Set index to 0 to send text globaly. */
105  native engclient_print(player,type,const message[],{Float,Sql,Result,_}:...);  native engclient_print(player,type,const message[],any:...);
106    
107  /* Sends message to console. */  /* Sends message to console. */
108  native console_print(id,const message[],{Float,Sql,Result,_}:...);  native console_print(id,const message[],any:...);
109    
110  /* Sends command to console. */  /* Sends command to console. */
111  native console_cmd(id,const cmd[],{Float,Sql,Result,_}:...);  native console_cmd(id,const cmd[],any:...);
112    
113  /* Registers event on which a given function will be called  /* Registers event on which a given function will be called
114  * Flags:  * Flags:
# Line 115  Line 117 
117  * "c" - send only once when repeated to other players.  * "c" - send only once when repeated to other players.
118  * "d" - call if is send to dead player.  * "d" - call if is send to dead player.
119  * "e" - to alive.  * "e" - to alive.
120    * NOTE: Due to a long-standing bug that would break compatibility with old plugins,
121    *       the client id should be checked for alive/dead state if you use d or e.
122  * Examples for conditions:  * Examples for conditions:
123  * "2=c4" - 2nd parameter of message must be sting "c4".  * "2=c4" - 2nd parameter of message must be sting "c4".
124  * "3>10" - 3rd parameter must be greater then 10.  * "3>10" - 3rd parameter must be greater then 10.
# Line 141  Line 145 
145  native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);  native set_hudmessage(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4);
146    
147  /* Displays HUD message to given player. */  /* Displays HUD message to given player. */
148  native show_hudmessage(index,const message[],{Float,Sql,Result,_}:...);  native show_hudmessage(index,const message[],any:...);
149    
150  /* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */  /* Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). */
151  native show_menu(index,keys,const menu[], time = -1, const title[] = "");  native show_menu(index,keys,const menu[], time = -1, const title[] = "");
# Line 150  Line 154 
154  * When you are asking for string the array and length is needed (read_data(2,name,len)).  * When you are asking for string the array and length is needed (read_data(2,name,len)).
155  * Integer is returned by function (new me = read_data(3)).  * Integer is returned by function (new me = read_data(3)).
156  * Float is set in second parameter (read_data(3,value)). */  * Float is set in second parameter (read_data(3,value)). */
157  native read_data(value, {Float,Sql,Result,_}:... );  native read_data(value, any:... );
158    
159  /* Returns number of values in client message. */  /* Returns number of values in client message. */
160  native read_datanum();  native read_datanum();
# Line 171  Line 175 
175    
176  /* Prints message to server console.  /* Prints message to server console.
177  * You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */  * You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) */
178  native server_print(const message[], {Float,Sql,Result,_}:...);  native server_print(const message[], any:...);
179    
180  /* Returns 1 or 0. */  /* Returns 1 or 0. */
181  native is_map_valid(const mapname[]);  native is_map_valid(const mapname[]);
# Line 239  Line 243 
243    
244  /* Returns id of currently carried weapon. Gets also  /* Returns id of currently carried weapon. Gets also
245  * ammount of ammo in clip and backpack. */  * ammount of ammo in clip and backpack. */
246  native get_user_weapon(index,&clip,&ammo);  native get_user_weapon(index,&clip=0,&ammo=0);
247    
248  /* Gets ammo and clip from current weapon. */  /* Gets ammo and clip from current weapon. */
249  native get_user_ammo(index,weapon,&clip,&ammo);  native get_user_ammo(index,weapon,&clip,&ammo);
# Line 305  Line 309 
309  *  ...      - optional parameters  *  ...      - optional parameters
310  * Return value:  * Return value:
311  *  always 0 */  *  always 0 */
312  native log_amx(const string[], {Float,Sql,Result,_}:...);  native log_amx(const string[], any:...);
313    
314  /* Sends message to standard HL logs. */  /* Sends message to standard HL logs. */
315  native log_message(const message[],{Float,Sql,Result,_}:...);  native log_message(const message[],any:...);
316    
317  /* Sends log message to specified file. */  /* Sends log message to specified file. */
318  native log_to_file(const file[],const message[],{Float,Sql,Result,_}:...);  native log_to_file(const file[],const message[],any:...);
319    
320  /* Returns number of players put in server.  /* Returns number of players put in server.
321  * If flag is set then also connecting are counted. */  * If flag is set then also connecting are counted. */
# Line 367  Line 371 
371  native remove_quotes(text[]);  native remove_quotes(text[]);
372    
373  /* Executes command on player. */  /* Executes command on player. */
374  native client_cmd(index,const command[],{Float,Sql,Result,_}:...);  native client_cmd(index,const command[],any:...);
375    
376  /* This is an emulation of a client command (commands aren't send to client!).  /* This is an emulation of a client command (commands aren't send to client!).
377  * It allows to execute some commands on players and bots.  * It allows to execute some commands on players and bots.
# Line 376  Line 380 
380  native engclient_cmd(index,const command[],const arg1[]="",const arg2[]="");  native engclient_cmd(index,const command[],const arg1[]="",const arg2[]="");
381    
382  /* Executes command on a server console. */  /* Executes command on a server console. */
383  native server_cmd(const command[],{Float,Sql,Result,_}:...);  native server_cmd(const command[],any:...);
384    
385  /* Sets a cvar to given value. */  /* Sets a cvar to given value. */
386  native set_cvar_string(const cvar[],const value[]);  native set_cvar_string(const cvar[],const value[]);
# Line 463  Line 467 
467  /* Returns 1 if task under given id exists. */  /* Returns 1 if task under given id exists. */
468  native task_exists(id = 0, outside = 0);  native task_exists(id = 0, outside = 0);
469    
470  /* Sets flags for player. Set flags to -1 if you want to clear all flags.  /* Sets the users flags with the assignment by bitwise OR operator. */
 * You can use different settings by changing the id, which is from range 0 - 31. */  
471  native set_user_flags(index,flags=-1,id=0);  native set_user_flags(index,flags=-1,id=0);
472    
473  /* Gets flags from player. Set index to 0 if you want to read flags from server. */  /* Gets flags from player. Set index to 0 if you want to read flags from server. */
# Line 474  Line 477 
477  native remove_user_flags(index,flags=-1,id=0);  native remove_user_flags(index,flags=-1,id=0);
478    
479  /* Registers function which will be called from client console.  /* Registers function which will be called from client console.
480     * Set FlagManager to 1 to make FlagManager always include this command
481     * Set FlagManager to 0 to make FlagManager never include this command
482   * Returns the command ID.   * Returns the command ID.
483   */   */
484  native register_clcmd(const client_cmd[],const function[],flags=-1, const info[]="");  native register_clcmd(const client_cmd[],const function[],flags=-1, const info[]="", FlagManager=-1);
485    
486  /* Registers function which will be called from any console.  /* Registers function which will be called from any console.
487     * Set FlagManager to 1 to make FlagManager always include this command
488     * Set FlagManager to 0 to make FlagManager never include this command
489   * Returns the command ID.   * Returns the command ID.
490   */   */
491  native register_concmd(const cmd[],const function[],flags=-1, const info[]="");  native register_concmd(const cmd[],const function[],flags=-1, const info[]="", FlagManager=-1);
492    
493  /* Registers function which will be called from server console.  /* Registers function which will be called from server console.
494   * Returns the command ID.   * Returns the command ID.
# Line 600  Line 607 
607  /* Returns number of currently registered modules */  /* Returns number of currently registered modules */
608  native get_modulesnum();  native get_modulesnum();
609    
610  /* Checks whether a plugin is loaded. If it is not, the return value is -1, otherwise  /**
611  * the return value is the plugin id. The function is case insensitive. */   * Checks whether a plugin is loaded by the given registered name (such as "Admin Base"), or, optionally
612  native is_plugin_loaded(const name[]);   * the given filename ("admin.amxx").
613     *
614     * @param name                  Either the plugin name to lookup, or the plugin filename to lookup.
615     * @param usefilename   Set to true if you want to search for the plugin by the filename, false to search
616     *                                              by the plugin's registered name.
617     *
618     * @return                              Plugin ID of the matching plugin on a successful search, -1 on a failed search.
619     *
620     * @note                                Prior to 1.8, this function would only search for plugins registered names, not
621     *                                              the filename.
622     *
623     * @note                                The plugin registered name search is a case insensitive search, however, the plugin
624     *                                              filename search is case sensitive.
625     */
626    native is_plugin_loaded(const name[], bool:usefilename=false);
627    
628  /* Gets info about plugin by given index.  /* Gets info about plugin by given index.
629   * Function returns -1 if plugin doesn't exist with given index.   * Function returns -1 if plugin doesn't exist with given index.
630   * Note: the [...] portion should not be used, and is only for backward compatibility.   * Note: the [...] portion should not be used, and is only for backward compatibility.
631   * Use index of -1 to use the calling plugin's ID.   * Use index of -1 to use the calling plugin's ID.
632   */   */
633  native get_plugin(index,filename[],len1,name[],len2,version[],len3,author[],len4,status[],len5,...);  native get_plugin(index,filename[]="",len1=0,name[]="",len2=0,version[]="",len3=0,author[]="",len4=0,status[]="",len5=0,...);
634    
635  /* Returns number of all loaded plugins. */  /* Returns number of all loaded plugins. */
636  native get_pluginsnum();  native get_pluginsnum();
# Line 698  Line 719 
719  /* Calculates the md5 keysum of a file */  /* Calculates the md5 keysum of a file */
720  native md5_file(const file[], md5buffer[34]);  native md5_file(const file[], md5buffer[34]);
721    
722  /* Returns the internal flags set on the called plugin's state  /* Returns the internal flags set on the plugin's state
723   * If hdr is 1, it will return the pcode flags rather than state flags.   * If hdr is 1, it will return the pcode flags rather than state flags.
724     *
725     * Use a plid of -1 to get the flags for the calling plugin.
726   */   */
727  native plugin_flags(hdr=0);  native plugin_flags(hdr=0, plid=-1);
728    
729  /* When using modules that aren't part of AMX Mod X base package, do  /**
730  * a require_module("modulename") for each of them within the plugin_modules()   * @deprecated
731  * forward. Module name is the one listed when doing "amxx modules" in server   * Do not use!
732  * console. */   */
733  forward plugin_modules();  forward plugin_modules();
734    
735  native require_module(const module[]);  native require_module(const module[]);
736    
737  native is_amd64_server();  native is_amd64_server();
738    
 /* Returns 0 on success, like the POSIX specification */  
 native mkdir(const dirname[]);  
   
739  /* Returns plugin id searched by file/name.  Returns INVALID_PLUGIN_ID on failure. */  /* Returns plugin id searched by file/name.  Returns INVALID_PLUGIN_ID on failure. */
740  native find_plugin_byfile(const filename[], ignoreCase=1);  native find_plugin_byfile(const filename[], ignoreCase=1);
741    
# Line 733  Line 753 
753   */   */
754  native register_native(const name[], const handler[], style=0);  native register_native(const name[], const handler[], style=0);
755    
756  /* Registers a library.  You can put #pragma library <name> in your include files,  /* Registers a library.  To mark a library as required, place the following
757   * and plugins that use your include without loading your plugin will get a nice   * in your include file:
758   * error message.   *  #pragma reqlib <name>
759     *  #if !defined AMXMODX_NOAUTOLOAD
760     *   #pragma loadlib <name>
761     *  #endif
762   */   */
763  native register_library(const library[]);  native register_library(const library[]);
764    
765  /* Logs an error in your native, and breaks into the debugger.  /* Logs an error in your native, and breaks into the debugger.
766   * Acts as if the calling plugin had the error.   * Acts as if the calling plugin had the error.
767   */   */
768  native log_error(error, const fmt[], ...);  native log_error(error, const fmt[], any:...);
769    
770  // More Dynamic Native System Stuff  // More Dynamic Native System Stuff
771  // Each of these natives affects one of the parameters sent to your native.  // Each of these natives affects one of the parameters sent to your native.
# Line 778  Line 801 
801  native set_array(param, const source[], size);  native set_array(param, const source[], size);
802  native set_array_f(param, const Float:source[], size);  native set_array_f(param, const Float:source[], size);
803    
 /** 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.  
 native player_menu_info(id, &menu, &newmenu);  
   
 //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);  
   
804  // Dispatches a client cvar query  // Dispatches a client cvar query
805  //  id: Player id  //  id: Player id
806  //  cvar: cvar name  //  cvar: cvar name
# Line 944  Line 903 
903   * Note that the plugin's filename is prepending to your message:   * Note that the plugin's filename is prepending to your message:
904   *  [myplugin.amxx] MESSAGE   *  [myplugin.amxx] MESSAGE
905   */   */
906  native abort(error, const fmt[]="", {Float,_}:...);  native abort(error, const fmt[]="", any:...);
907    
908  /**  /**
909   * Checks if a specific module is loaded.  This is the exact same method AMX Mod X   * Checks if a specific module is loaded.  This is the exact same method AMX Mod X
# Line 987  Line 946 
946   * You must use set_hudmessage, although the channel parameter is   * You must use set_hudmessage, although the channel parameter is
947   *  entirely ignored.   *  entirely ignored.
948   */   */
949  native ShowSyncHudMsg(target, syncObj, const fmt[], ...);  native ShowSyncHudMsg(target, syncObj, const fmt[], any:...);
950    
951  /**  /**
952   * Clears the display on a HudSync Object.  This is essentially the same   * Clears the display on a HudSync Object.  This is essentially the same
# Line 1011  Line 970 
970  //Returns the reference address of the variable passed in.  //Returns the reference address of the variable passed in.
971  //This address is local to the plugin, and not a full CPU address  //This address is local to the plugin, and not a full CPU address
972  //pass the variable as the first parameter  //pass the variable as the first parameter
973  native get_var_addr(...);  native get_var_addr(any:...);
974    
975  //Returns the value of an address.  This dereferences something returned by  //Returns the value of an address.  This dereferences something returned by
976  // get_var_addr().  Attempting to pass in a value beyond stack or heap limits  // get_var_addr().  Attempting to pass in a value beyond stack or heap limits
# Line 1055  Line 1014 
1014   * executes a forward.  returns result in ret.   * executes a forward.  returns result in ret.
1015   * returns 1 for success, 0 for failure.   * returns 1 for success, 0 for failure.
1016   */   */
1017  native ExecuteForward(forward_handle, &ret, {Float,_}:...);  native ExecuteForward(forward_handle, &ret, any:...);
1018    
1019  /**  /**
1020   * Destroys/deallocates any type of forward   * Destroys/deallocates any type of forward
# Line 1080  Line 1039 
1039  native Float:get_pcvar_float(pcvar);  native Float:get_pcvar_float(pcvar);
1040  native set_pcvar_float(pcvar, Float:num);  native set_pcvar_float(pcvar, Float:num);
1041  native get_pcvar_string(pcvar, string[], maxlen);  native get_pcvar_string(pcvar, string[], maxlen);
1042    native set_pcvar_string(pcvar, const string[]);
1043    
1044  /**  /**
1045   * Sets a whole array to a certain value.   * Sets a whole array to a certain value.
# Line 1092  Line 1052 
1052   */   */
1053  native get_weaponid(const name[]);  native get_weaponid(const name[]);
1054    
1055    /**
1056     * Adds an admin to the dynamic admin storage
1057     * for lookup at a later time
1058     */
1059    native admins_push(const AuthData[], const Password[], Access, Flags);
1060    
1061    /**
1062     * Gets the number of admins in the dynamic admin
1063     * storage list
1064     */
1065    native admins_num();
1066    
1067    /**
1068     * Gets information about a dynamically stored admin
1069     * Use the enum AdminProp
1070     * Returns an integer value: AdminProp_Access, AdminProp_Flags
1071     * Sets the buffer string: AdminProp_Auth, AdminProp_Password
1072     */
1073    native admins_lookup(num, AdminProp:Property, Buffer[]="", BufferSize=0);
1074    
1075    /**
1076     * Clears the list of dynamically stored admins
1077     */
1078    native admins_flush();
1079  // Keep this always at the bottom of this file  // Keep this always at the bottom of this file
1080  #include <message_stocks>  #include <message_stocks>

Legend:
Removed from v.16  
changed lines
  Added in v.17

Contact
ViewVC Help
Powered by ViewVC 1.0.4