Functions
amxmodx.inc
amxmodx 1.8.2 hg65
| Function | Type | Description |
|---|---|---|
| client_authorized | forward | Called when client gets valid STEAM id (usually between client_connect() and client_putinserver()). |
| client_command | forward | Called when client is sending command. |
| client_connect | forward | Called on client connection. |
| client_disconnect | forward | Called when client is disconnecting from server. |
| client_infochanged | forward | Whenever player info is changed, this function is called. |
| client_putinserver | forward | Called when client is entering to a game. |
| inconsistent_file | forward | Called on inconsistent file. You can put any text into reason to change an original message. |
| plugin_cfg | forward | Function is called when all plugin_init from plugins were called, so all commmands and cvars should be already registered. |
| plugin_end | forward | Function called before plugin unloading (server deactivation) |
| plugin_init | forward | Function is called just after server activation. Good place for configuration loading, commands and cvars registration. |
| plugin_log | forward | Called on log message. |
| plugin_modules | forward | This function has no description. |
| plugin_natives | forward | This is called before plugin_init and allows you to register natives. |
| plugin_pause | forward | Called when the plugin is paused. |
| plugin_precache | forward | Use here model_precache() and sound_precache() functions. |
| plugin_unpause | forward | Called when the plugin is unpaused. |
| server_changelevel | forward | Called when the mod tries to change the map. |
| ClearSyncHud | native | Clears the display on a HudSync Object. This is essentially the same thing as: ShowSyncHudMsg(x, y, ""), except doing that would send out two messages and use up another channel. This re-uses the last channel and clears it at the same time. Note: for this you do not have to use set_hudmessage(). Note: target can be 0 for all players. |
| CreateHudSyncObj | native | Creates a HUD Synchronization Object. Create one of these for each section of the screen that contains overlapping HUD messages. For example, if you use both sides of the screen to display three messages that can potentially overlap, each side counts as a synchronizable area. You can then use ShowSyncHudMsg() to correctly synchronize displaying the HUD message with any other messages potentially in its class. Note that this does not yet do anything like reserve screen area, its sole purpose is to be able to wipe an old message on an auto-channel and ensure that it will not clear a message from another plugin. The parameters are kept blank for future use. |
| CreateMultiForward | native | Creates a multi-plugin forward. Stop type must be one of the ET_ values in amxconst.inc results will be > 0 for success |
| CreateMultiForwardEx | native | Creates a multi-forward plugin that can filter between old/new plugins. Old plugins are used by the AMX Mod backwards compatibility layer. Stop type must be one of the ET_ values in amxconst.inc Forward type must be one of the FORWARD_ values in amxconst.inc. |
| CreateOneForward | native | Creates a forward for one plugin. Results will be > 0 for success. id should be an id such as returned by find_plugin_byfile. Unlike get_plugin(), negative numbers will not work. |
| DestroyForward | native | Destroys/deallocates any type of forward |
| ExecuteForward | native | executes a forward. returns result in ret. returns 1 for success, 0 for failure. |
| LibraryExists | native | Checks if a library/class is loaded. This is the newer version of module_exists. |
| PrepareArray | native | prepares an array. use this and pass the result into ExecuteForward() instead of the array itself. |
| ShowSyncHudMsg | native | Displays a synchronized HUD message. This will check that your HUD object has its previous display on the screen cleared before it proceeds to write another. It will only do this in the case of that channel not having been cleared already. Target can be 0 for all players or 1-get_maxplayers(). You must use set_hudmessage, although the channel parameter is entirely ignored. |
| abort | native | Aborts execution of the current callback. Your script will throw a run time error. You can also specify an optional message. You should NOT call this function inside: - Error or module filters (native filters are safe if trap is 1) - plugin_natives() Note that the plugin's filename is prepending to your message: [myplugin.amxx] MESSAGE |
| admins_flush | native | Clears the list of dynamically stored admins |
| admins_lookup | native | Gets information about a dynamically stored admin Use the enum AdminProp Returns an integer value: AdminProp_Access, AdminProp_Flags Sets the buffer string: AdminProp_Auth, AdminProp_Password |
| admins_num | native | Gets the number of admins in the dynamic admin storage list |
| admins_push | native | Adds an admin to the dynamic admin storage for lookup at a later time |
| arrayset | native | Sets a whole array to a certain value. |
| callfunc_begin | native | Call a function in this / an another plugin by name. Parameters: plugin - plugin filename; if "", the caller plugin is used. If specified, it has to be the exact filename (for example stats.amxx) func - function name Return value: 1 - Success 0 - Runtime error -1 - Plugin not found -2 - Function not found |
| callfunc_begin_i | native | Call a function in this / an another plugin by id. Parameters: plugin - plugin id; the id you would pass to get_plugin If < 0, the current plugin is taken func - function id Return value: 1 - Success -1 - Plugin not found -2 - Function not executable |
| callfunc_end | native | Make the actual call. Return value of the function called. |
| callfunc_push_array | native | This function has no description. |
| callfunc_push_float | native | This function has no description. |
| callfunc_push_floatrf | native | This function has no description. |
| callfunc_push_int | native | Push a parameter (integer, string, float) Note that none of these values are const. Anything pushed by intrf, floatrf, array, or str can be modified by the called function. |
| callfunc_push_intrf | native | This function has no description. |
| callfunc_push_str | native | If copyback is 1 (default), any changes are copied back. Note that this will defy the 'const' specifier for push_str(), which is only kept for special backwards compatibility. |
| change_task | native | Changes the time of a task |
| client_cmd | native | Executes command on player. |
| client_print | native | Sends message to player. Set index to 0 to send text globaly. |
| console_cmd | native | Sends command to console. |
| console_print | native | Sends message to console. |
| cvar_exists | native | If a cvar exists returns 1, in other case 0 |
| dbg_fmt_error | native | Gets the formatted error string, which looks like "Run time error X: (description)" |
| dbg_trace_begin | native | Gets a trace handle for the item at the top of the traced call stack. Returns 0 if no debugging information is available. |
| dbg_trace_info | native | Gets the call stack info for a trace. |
| dbg_trace_next | native | Gets the next item in a traced call stack. Returns 0 if no more traces exist. |
| emit_sound | native | Emits sound. Sample must be precached. |
| engclient_cmd | native | This is an emulation of a client command (commands aren't send to client!). It allows to execute some commands on players and bots. Function is excellent for forcing to do an action related to a game (not settings!). The command must stand alone but in arguments you can use spaces. |
| engclient_print | native | Sends message to player by engine. Set index to 0 to send text globaly. |
| find_player | native | Find player. Flags: "a" - with given name. "b" - with given part of name. "c" - with given authid. "d" - with given ip. "e" - with given team name. "f" - don't look in dead players. "g" - don't look in alive players. "h" - skip bots. "i" - skip real players. "j" - return index of last found player. "k" - with given userid. "l" - ignore case sensitivity. |
| find_plugin_byfile | native | Returns plugin id searched by file/name. Returns INVALID_PLUGIN_ID on failure. |
| force_unmodified | native | Forces the client and server to be running with the same version of the specified file ( e.g., a player model ). |
| format_time | native | Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S". Last parameter sets time to format. |
| get_addr_val | native | This function has no description. |
| get_amxx_verstring | native | Returns AMXX's version string of the current gameserver |
| get_array | native | This function has no description. |
| get_array_f | native | This function has no description. |
| get_clcmd | native | Gets info about client command. |
| get_clcmdsnum | native | Returns number of registered client commands. |
| get_concmd | native | Gets info about console command. If id is set to 0, then function returns only server cmds, if positive then returns only client cmds. in other case returns all console commands. |
| get_concmd_plid | native | Gets the parent plugin id of a console command. |
| get_concmdsnum | native | Returns number of registered console commands. |
| get_cvar_flags | native | Returns a cvar flags. |
| get_cvar_float | native | Gets a cvar float. |
| get_cvar_num | native | Gets a cvar integer value. |
| get_cvar_pointer | native | Get a cvar pointer. Returns 0 if not found. |
| get_cvar_string | native | Reads a cvar value. |
| get_flags | native | Converts sum of bits to string. Example: 3 will return "ab". |
| get_float_byref | native | This function has no description. |
| get_func_id | native | Get a function id (for callfunc_begin_i) To get the plugin id, use the find_plugin stock |
| get_gametime | native | Returns a game time. |
| get_localinfo | native | Gets info from server. |
| get_mapname | native | Returns a name of currently played map. |
| get_maxplayers | native | Returns maxplayers setting. |
| get_modname | native | Returns a name of currently played mod. |
| get_module | native | Gets info about a module. Parameters: id - the id of the module name[] - The name of the module will be stored here nameLen - maximal length of the name author[] - the author will be stored here authorLen - maximal length of the author version[] - the version of the module will be stored here versionLen - maximal length of the version status - the status of the module will be stored here Return value: id - success -1 - module not found |
| get_modulesnum | native | Returns number of currently registered modules |
| get_param | native | This function has no description. |
| get_param_byref | native | This function has no description. |
| get_param_f | native | This function has no description. |
| get_pcvar_flags | native | This function has no description. |
| get_pcvar_float | native | This function has no description. |
| get_pcvar_num | native | This function has no description. |
| get_pcvar_string | native | This function has no description. |
| get_players | native | Sets indexes of players. Flags: "a" - don't collect dead players. "b" - don't collect alive players. "c" - skip bots. "d" - skip real players. "e" - match with team. "f" - match with part of name. "g" - ignore case sensitivity. "h" - skip HLTV. Example: Get all alive CTs: get_players(players,num,"ae","CT") |
| get_playersnum | native | Returns number of players put in server. If flag is set then also connecting are counted. |
| get_plugin | native | Gets info about plugin by given index. Function returns -1 if plugin doesn't exist with given index. Note: the [...] portion should not be used, and is only for backward compatibility. Use index of -1 to use the calling plugin's ID. |
| get_plugins_cvar | native | Returns information about a plugin-registered cvar. |
| get_plugins_cvarsnum | native | Returns the number of plugin-registered cvars. |
| get_pluginsnum | native | Returns number of all loaded plugins. |
| get_srvcmd | native | Gets info about server command. |
| get_srvcmdsnum | native | Returns number of registered server commands. |
| get_string | native | This function has no description. |
| get_systime | native | Returns system time in seconds elapsed since 00:00:00 on January 1, 1970. Offset is given in seconds. |
| get_time | native | Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S". |
| get_timeleft | native | Returns time remaining on map in seconds. |
| get_user_aiming | native | If player doesn't hit at anything function returns 0.0, in other case the distance between hit point and player is returned. If player is aiming at another player then the id and part of body are set. |
| get_user_ammo | native | Gets ammo and clip from current weapon. |
| get_user_armor | native | Returns player armor. |
| get_user_attacker | native | If player is not attacked function returns 0, in other case returns index of attacking player. On second and third parameter you may get info about weapon and body hit place. As of 1.75, get_user_attacker can return a non-player index if the player was attacked by a non-player entity. |
| get_user_authid | native | Gets player authid. |
| get_user_deaths | native | Returns player deaths. |
| get_user_flags | native | Gets flags from player. Set index to 0 if you want to read flags from server. |
| get_user_frags | native | Returns player frags. |
| get_user_health | native | Returns player health. |
| get_user_index | native | Returns index. |
| get_user_info | native | Gets info from player. |
| get_user_ip | native | Returns ip. |
| get_user_menu | native | Gets what menu the player is watching and what keys for menu he have. When there is no menu the index is 0. If the id is negative then the menu is VGUI in other case the id is from register_menuid() function. |
| get_user_msgid | native | Returns id of client message. Example: get_user_msgid("TextMsg"). |
| get_user_msgname | native | Gets name of client message index. Return value is number of characters copied into name. Returns 0 on invalid msgid. |
| get_user_name | native | Returns player name. |
| get_user_origin | native | Gets origin from player. Modes: 0 - current position. 1 - position from eyes (weapon aiming). 2 - end position from player position. 3 - end position from eyes (hit point for weapon). 4 - position of last bullet hit (only CS). |
| get_user_ping | native | Gets ping and loss at current time. |
| get_user_team | native | Returns team id. When length is greater then 0 then a name of team is set. |
| get_user_time | native | Returns player playing time in seconds. If flag is set then result is without connection time. |
| get_user_userid | native | Returns player userid. |
| get_user_weapon | native | Returns id of currently carried weapon. Gets also ammount of ammo in clip and backpack. |
| get_user_weapons | native | Returns all carried weapons as bit sum. Gets also theirs indexes. Note that num is incremental - if you pass 0, you get 32 weapons towards the total. Afterwards, num will will contain the number of weapons retrieved. However, subsequent calls to get_user_weapons() will return the next batch of weapons, in case the mod supports more than 32 weapons. This means to call get_user_weapons() on the same inputs twice, you must reset num to 0 to get the original output again. |
| get_var_addr | native | This function has no description. |
| get_weaponid | native | Returns the weapon id, otherwise 0 when no id found. The weapon name is case sensitive, and has the weapon_* form. |
| get_weaponname | native | Returns weapon name. |
| get_xvar_float | native | Returns a float value of a public variable. Id is a value returned by get_xvar_id(...) native. |
| get_xvar_id | native | Returns an unique id for public variable specified by name. If such variable doesn't exist then returned value is -1. |
| get_xvar_num | native | Returns an integer value of a public variable. Id is a value returned by get_xvar_id(...) native. |
| int3 | native | This function has no description. |
| is_amd64_server | native | This function has no description. |
| is_dedicated_server | native | Returns 1 or 0. |
| is_jit_enabled | native | Returns 1 or 0. |
| is_linux_server | native | Returns 1 or 0. |
| is_map_valid | native | Returns 1 or 0. |
| is_module_loaded | native | Checks whether a module is loaded. If it is not, the return value is -1, otherwise the return value is the module id. The function is case insensitive. |
| is_plugin_loaded | native | Checks whether a plugin is loaded by the given registered name (such as "Admin Base"), or, optionally the given filename ("admin.amxx"). |
| is_user_alive | native | Returns 1 or 0. |
| is_user_bot | native | Returns 1 or 0. |
| is_user_connected | native | Returns 1 or 0. |
| is_user_connecting | native | Returns 1 or 0. |
| is_user_hltv | native | Returns 1 or 0. |
| log_amx | native | Logs something into the current amx logfile Parameters: string[] - format string ... - optional parameters Return value: always 0 |
| log_error | native | Logs an error in your native, and breaks into the debugger. Acts as if the calling plugin had the error. |
| log_message | native | Sends message to standard HL logs. |
| log_to_file | native | Sends log message to specified file. |
| md5 | native | Calculates the md5 keysum of a string |
| md5_file | native | Calculates the md5 keysum of a file |
| module_exists | native | Checks if a specific module is loaded. This is the exact same method AMX Mod X uses to see if a module is required by a plugin. For example: module_exists("cstrike") module_exists("dbi") |
| next_hudchannel | native | Returns the next valid hudchannel for a user, from 1-4. |
| num_to_word | native | Converts numbers from range 0 - 999 to words. |
| param_convert | native | This function has no description. |
| parse_loguser | native | Parse log data about user ( "Butcher<5><BOT><TERRORIST>" etc. ). |
| parse_time | native | Returns time in input and additionaly fills missing information with current time and date. If time is different than -1 then parsed time is added to given time. Example: parset_time( "10:32:54 04/02/2003", "%H:%M:%S %m:%d:%Y" ) For more information see strptime(...) function from C libraries. |
| pause | native | Pauses function or plugin so it won't be executed. In most cases param1 is name of function and param2 name of plugin (all depends on flags). Flags: "a" - pause whole plugin. "c" - look outside the plugin (by given plugin name). "d" - set "stopped" status when pausing whole plugin. In this status plugin is unpauseable. Example: pause("ac","myplugin.amxx") Note: There used to be the b and e flags as well, which have been deprecated and are no longer used. |
| plugin_flags | native | Returns the internal flags set on the plugin's state If hdr is 1, it will return the pcode flags rather than state flags. Use a plid of -1 to get the flags for the calling plugin. |
| precache_generic | native | Precaches any file. |
| precache_model | native | Precache model. Can be used only in plugin_precache() function. |
| precache_sound | native | Precache sound. Can be used only in plugin_precache() function. |
| query_client_cvar | native | This function has no description. |
| random_float | native | Generates random floating point number from a to b. |
| random_num | native | Generates random integer from a to b. |
| read_argc | native | Returns number of arguments (+ one as command). |
| read_args | native | Gets line of all arguments. |
| read_argv | native | Gets argument from command. |
| read_data | native | Gets value from client messages. When you are asking for string the array and length is needed (read_data(2,name,len)). Integer is returned by function (new me = read_data(3)). Float is set in second parameter (read_data(3,value)). |
| read_datanum | native | Returns number of values in client message. |
| read_flags | native | Converts string to sum of bits. Example: "abcd" is a sum of 1, 2, 4 and 8. |
| read_logargc | native | Returns number of log arguments. Can be called only in plugin_log() forward function. |
| read_logargv | native | Gets log argument indexed from 0. Can be called only in plugin_log() forward function. |
| read_logdata | native | Gets log message. Can be called only in plugin_log() forward function. |
| register_clcmd | native | Registers function which will be called from client console. Set FlagManager to 1 to make FlagManager always include this command Set FlagManager to 0 to make FlagManager never include this command Returns the command ID. |
| register_concmd | native | Registers function which will be called from any console. Set FlagManager to 1 to make FlagManager always include this command Set FlagManager to 0 to make FlagManager never include this command Returns the command ID. |
| register_cvar | native | Registers new cvar for HL engine. Returns the cvar pointer for get/set_pcvar functions. |
| register_event | native | Registers event on which a given function will be called Flags: "a" - global event. "b" - specified. "c" - send only once when repeated to other players. "d" - call if is send to dead player. "e" - to alive. NOTE: Due to a long-standing bug that would break compatibility with old plugins, the client id should be checked for alive/dead state if you use d or e. Examples for conditions: "2=c4" - 2nd parameter of message must be sting "c4". "3>10" - 3rd parameter must be greater then 10. "3!4" - 3rd must be different from 4. "2&Buy" - 2nd parameter of message must contain "Buy" substring. "2!Buy" - 2nd parameter of message can't contain "Buy" substring. |
| register_library | native | Registers a library. To mark a library as required, place the following in your include file: #pragma reqlib <name> #if !defined AMXMODX_NOAUTOLOAD #pragma loadlib <name> #endif |
| register_logevent | native | Registers log event on which the given function will be called Examples for conditions: "0=World triggered" "1=Game_Commencing" "1=say" "3=Terrorists_Win" "1=entered the game" "0=Server cvar" |
| register_menucmd | native | Calls function when player uses specified menu and proper keys. |
| register_menuid | native | Gets unique id of menu. Outside set to 1 allows to catch menus outside a plugin where register_menuid is called. |
| register_native | native | 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! |
| register_plugin | native | Sets informations about plugin. Returns the plugin id of the calling plugin. |
| register_srvcmd | native | Registers function which will be called from server console. Returns the command ID. |
| remove_cvar_flags | native | Removes a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars). |
| remove_quotes | native | Removes quotes from sentence. |
| remove_task | native | Removes all tasks with given id. If outside var is set then a task can be removed also when was set in another plugin. |
| remove_user_flags | native | Removes flags for player. |
| require_module | native | This function has no description. |
| server_cmd | native | Executes command on a server console. |
| server_exec | native | Forces server to execute sent server command at current time. Very useful for map changes, setting cvars and other activities. |
| server_print | native | Prints message to server console. You may use text formating (f.e. server_print("%-32s %.2f!","hello",7.345)) |
| set_addr_val | native | This function has no description. |
| set_array | native | This function has no description. |
| set_array_f | native | This function has no description. |
| set_cvar_flags | native | Sets a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars). |
| set_cvar_float | native | Sets a cvar to given float. |
| set_cvar_num | native | Sets a cvar with integer value. |
| set_cvar_string | native | Sets a cvar to given value. |
| set_error_filter | native | Allows you to trap error messages that occur in your plugin. You can use this to override the debug messages that occur when your plugin causes some sort of runtime error. Your handler will be called in this style: public error_filter(error_code, bool:debugging, message[]) error_code is the AMX_ERR code. debugging is whether or not the plugin is in debug mode. message[] is any message that was sent along with the error. Return PLUGIN_CONTINUE to let the error pass through the filter. Return PLUGIN_HANDLED to block the error from displaying. |
| set_fail_state | native | This function has no description. |
| set_float_byref | native | This function has no description. |
| set_hudmessage | native | Sets format for hudmessage. Note - as of AMX Mod X 1.61, setting the channel to -1 will automatically choose the next available HUD channel for a player. |
| set_localinfo | native | Sets info for server. |
| set_module_filter | native | This function sets a module/library filter. It will let you intercept the automatic requirement of a module and return PLUGIN_CONTINUE to fail load or PLUGIN_HANDLED to imply that load can continue even without the module. This is the most unforgiving of the filter functions. You can ONLY call it during plugin_natives, and any error that occurs is not filtered -- instead your plugin will fail to load as if you returned PLUGIN_CONTINUE. Your handler will be called with this prototype: public module_filter(const library[], LibType:type); library - library or class name of the module that is required libtype - The type of requirement being checked (library/module or class). set_module_filter() returns 0 on success (unlike most natives). |
| set_native_filter | native | Sets a native filter. This must be first set in plugin_natives(), but future calls will simply set a new filter. This filter will allow your plugin to load even if its modules aren't loaded. For example, if Fun isn't loaded and you use set_user_frags, your plugin will still load. However, if you attempt to call this native, your filter will intercept it with these parameters: public function native_filter(const name[], index) native - name of native index - index of native trap - 0 if native couldn't be found, 1 if native use was attempted If you return PLUGIN_HANDLED, no error is thrown. If you return PLUGIN_CONTINUE, your plugin will have a run-time-error. To print your own error, or change the default, you can return PLUGIN_HANDLED or return PLUGIN_CONTINUE and use set_error_filter. If you return PLUGIN_CONTINUE when trap is 0, the plugin will ABORT AND FAIL TO LOAD! When trap is 0, it is unsafe to use natives that modify the server or use other plugins. |
| set_param_byref | native | This function has no description. |
| set_pcvar_flags | native | This function has no description. |
| set_pcvar_float | native | This function has no description. |
| set_pcvar_num | native | This function has no description. |
| set_pcvar_string | native | This function has no description. |
| set_string | native | This function has no description. |
| set_task | native | Calls function on specified time. Flags: "a" - repeat. "b" - loop task. "c" - do task on time after a map timeleft. "d" - do task on time before a map timelimit. |
| set_user_flags | native | Sets the users flags with the assignment by bitwise OR operator. |
| set_user_info | native | Sets info for player. |
| set_xvar_float | native | Sets a float value of a public variable. Id is a value returned by get_xvar_id(...) native. |
| set_xvar_num | native | Sets a value of a public variable. Id is a value returned by get_xvar_id(...) native. |
| show_hudmessage | native | Displays HUD message to given player. |
| show_menu | native | Displays menu. Keys have bit values (key 1 is (1<<0), key 5 is (1<<4) etc.). |
| show_motd | native | Shows text in MOTD window. When there is no header, the MOTD title will be the name of server. If message is filename, then a contents of this file will be displayed as MOTD. |
| task_exists | native | Returns 1 if task under given id exists. |
| unpause | native | Unpauses function or plugin. Flags: "a" - unpause whole plugin. "c" - look outside the plugin (by given plugin name). |
| user_has_weapon | native | Returns if the player has the weapon or not in their pev->weapons field. set "setweapon" to 0 to turn the bit off, set to 1 to turn it on. |
| user_kill | native | Kills player. When flag is set to 1 then death won't decrase frags. |
| user_slap | native | Slaps player with given power. |
| xvar_exists | native | Checks if public variable with given name exists in loaded plugins. |