Core
Content:
Notes
The AMX Mod X core contains the native and "essential" scripting functions. Functions are rarely added to the core unless they fit into a specific category. The AMXx Core is maintained by PM OnoTo.

The core is broken up into multiple sections. By including "amxmodx.inc", you automatically include the subsections.
There are a number of constants in the Core, listed here:
"Variable" Constants:
AMXX_VERSION		//AMXx Version
AMXX_VERSION_STRN	//AMXx Version as string

Admin Level Constants:
ADMIN_ALL		0	//Everyone
ADMIN_IMMUNITY		1	//Flag "a", immunity
ADMIN_RESERVATION	2	//Flag "b", reservation
ADMIN_KICK		4	//Flag "c", kick
ADMIN_BAN		8	//Flag "d", ban
ADMIN_SLAY		16	//Flag "e", slay
ADMIN_MAP		32	//Flag "f", map change
ADMIN_CVAR		64	//Flag "g", cvar change
ADMIN_CFG		128	//Flag "h", config execution
ADMIN_CHAT		256	//Flag "i", chat
ADMIN_VOTE		512	//Flag "j", vote
ADMIN_PASSWORD		1024	//Flag "k", sv_password
ADMIN_RCON		2048	//Flag "l", rcon access
ADMIN_LEVEL_A		4096	//Flag "m", custom
ADMIN_LEVEL_B		8192	//Flag "n", custom
ADMIN_LEVEL_C		16384	//Flag "o", custom
ADMIN_LEVEL_D		32768	//Flag "p", custom
ADMIN_LEVEL_E		65536	//Flag "q", custom
ADMIN_LEVEL_F		131072	//Flag "r", custom
ADMIN_LEVEL_G		262144	//Flag "s", custom
ADMIN_LEVEL_H		524288	//Flag "t", custom
ADMIN_MENU		1048576	//Flag "u", menus
ADMIN_ADMIN		16777216	//Flag "y", default admin
ADMIN_USER		33554432	//Flag "z", default user

FLAG_KICK		1	//Auth flag "a", kick if no auth
FLAG_TAG		2	//Auth flag "b", auth by tag
FLAG_AUTHID		4	//Auth flag "c", auth by WON/Steam ID
FLAG_IP			8	//Auth flag "d", auth by IP address
FLAG_NOPASS		16	//Auth flag "e", don't require password

Return Codes:
//Plugin passes through operation.  Whatever called it continues.
PLUGIN_CONTINUE		0
//Plugin halts continued operation (plugins following in the plugins.ini won't be called).
//Whatever called it will eventually supercede.
PLUGIN_HANDLED		1
//Continue calling plugins but halt the operation
PLUGIN_HANDLED_MAIN	2

Message Constants:
MSG_BROADCAST		0	//Unreliable message to everyone
MSG_ONE			1	//Reliable message to one client
MSG_ALL			2	//Reliable message to everyone
MSG_INIT		3	//Write to the init string
MSG_PVS			4	//Ents in PVS of origin
MSG_PAS			5	//Ents in PAS of origin
MSG_PVS_R		6	//Reliable to PVS
MSG_PAS_R		7	//Reliable to PAS
MSG_ONE_UNRELIABLE	8	//Unreliable to one client
MSG_SPEC		9	//Send to spectator proxies

SVC_TEMPENTITY		23
SVC_INTERMISSION	30
SVC_CDTRACK		32
SVC_WEAPONANIM		35
SVC_ROOMTYPE		37
SVC_ADDANGLE		38
SVC_NEWUSERMSG		39
SVC_HLTV		50

CVAR Constants:
FCVAR_ARCHIVE		1	//Gets saved to vars.rc
FCVAR_USERINFO		2	//Changes client's info string
FCVAR_SERVER		4	//Notifies players when changed
FCVAR_EXTDLL		8	//Defined by external DLL
FCVAR_CLIENTDLL		16	//Defined by client DLL
FCVAR_PROTECTED		32	//Contains a password/private info
FCVAR_SPONLY		64	//Cannot be changed by clients in multiplayer
FCVAR_PRINTABLEONLY	128	//Cannot contain unprintable characters
FCVAR_UNLOGGED		256	//Don't log changes if FCVAR_SERVER

Sound Constants:
//Sound Channels
CHAN_AUTO		0
CHAN_WEAPON		1
CHAN_VOICE		2
CHAN_ITEM		3
CHAN_BODY		4
CHAN_STREAM		5	//Stream channel from static or dynamic area
CHAN_STATIC		6	//Channel from the static area
CHAN_NETWORKVOICE_BASE	7	//Voice data coming across the network
CHAN_NETWORKVOICE_END	500	//Network voice data reserves slots

//Attenuation values
ATTN_NONE		0.00
ATTN_NORM		0.80
ATTN_IDLE		2.00
ATTN_STATIC		1.25

//Pitch values
PITCH_NORM		100
PITCH_LOW		95
PITCH_HIGH		120

//Volume values
VOL_NORM		1.0

HI Weapon Constants:
#define HIW_BERETTA		1
#define HIW_SPAS12		2
#define HIW_M4A1		3
#define HIW_MP5A4		4
#define HIW_MP5SD5		5
#define HIW_AK47		6
#define HIW_AKS74U		7
#define HIW_GLOCK		8
#define HIW_M11			9
#define HIW_M11SD		10
#define HIW_PSG1		11
#define HIW_ZASTAVA		12
#define HIW_M16A2		13
#define HIW_REMINGTON		14
#define HIW_NATOGREN		15
#define HIW_TANGOGREN		16
#define HIW_FLASHBANG		17

Menu Key Defines:
/* Menu keys */
#define MENU_KEY_1		(1<<0)
#define MENU_KEY_2		(1<<1)
#define MENU_KEY_3		(1<<2)
#define MENU_KEY_4		(1<<3)
#define MENU_KEY_5		(1<<4)
#define MENU_KEY_6		(1<<5)
#define MENU_KEY_7		(1<<6)
#define MENU_KEY_8		(1<<7)
#define MENU_KEY_9		(1<<8)
#define MENU_KEY_0		(1<<9)

Print Types:
/* Destination types for client_print() */
enum {
	print_notify = 1,
	print_console,
	print_chat,
	print_center,
}

/* Destination types for engclient_print() */
enum {
	engprint_console = 0,
	engprint_center,
	engprint_chat,
}

Unmodified Constants:
/* Type for force_unmodified() */
enum {
	force_exactfile = 0,		/* File on client must exactly match server's file */
	force_model_samebounds,		/* For model files only, the geometry must fit in the same bbox */
	force_model_specifybounds,	/* For model files only, the geometry must fit in the specified bbox */
}

Module Constants:
/* Status for get_module() */
enum {
	module_none = 0,
	module_query,
	module_badload,
	module_loaded,
	module_noinfo,
	module_noquery,
	module_noattach,
	module_old,
};

AMX Flag Constants:
#define AMX_FLAG_DEBUG    0x02  /* symbolic info. available */
#define AMX_FLAG_COMPACT  0x04  /* compact encoding */
#define AMX_FLAG_BYTEOPC  0x08  /* opcode is a byte (not a cell) */
#define AMX_FLAG_NOCHECKS 0x10  /* no array bounds checking; no STMT opcode */
#define AMX_FLAG_NTVREG 0x1000  /* all native functions are registered */
#define AMX_FLAG_JITC   0x2000  /* abstract machine is JIT compiled */
#define AMX_FLAG_BROWSE 0x4000  /* busy browsing */
#define AMX_FLAG_RELOC  0x8000  /* jump/call addresses relocated */
#define INVALID_PLUGIN_ID	-1

//These are for the new menu system
//Specifies which "magic/special" item was selected
#define MENU_EXIT	-3
#define	MENU_BACK	-2
#define MENU_MORE	-1
//Returns the state of an item in an item display callback
#define	ITEM_IGNORE	0
#define	ITEM_ENABLED	1
#define ITEM_DISABLED	2
Functions
access - Checks if the player has a specific admin flag.
add - Adds one string to another.
AddMenuItem - Add a menu item to Menus Front-End plugin.
callfunc_begin - Call a function in this / an another plugin by name.
callfunc_begin_i - Call a function in this / an another plugin by id.
callfunc_end - Make the actual call. Return value of the function called.
callfunc_push_float - Pushes a floating point number to a function call.
callfunc_push_floatrf - Pushes a floating point number to a function call by reference.
callfunc_push_int - Pushes a normal number to a function call.
callfunc_push_intrf - Pushes a variable by reference onto a function call.
callfunc_push_str - Pushes a string to a function call.
change_task - Changes the time of a task.
clamp - Returns value if it is in the range min-max, min if value is lower than min, max if higher than max.
client_authorized - Called when a player has authenticated with Steam
client_cmd - Executes command on a player
client_command - Called when a client sends a command.
client_connect - Called when a client connects
client_disconnect - Called when a player disconnects
client_infochanged - Called when a user's client info struct is changed
client_print - Sends a message to a player.
client_putinserver - Called when a player is initialized into the game.
close_dir - Closes a directory handle.
cmd_access - Checks if a user has access for that command.
cmd_target - Locates a player id by specific parameters.
colored_menus - Checks if the current mod supports colored menus.
console_cmd - Sends a command to a player's console
console_print - Sends a message to a player's console
contain - Returns position of string found inside of source, or -1 on failure.
containi - Returns position of string found inside of source, or -1 on failure. Case insensitive.
copy - Copies one string to another for a maximum for len characters.
copyc - Copies one string to another for a maximum for len characters, UNTIL ch is found.
cstrike_running - Checks if a Counter-Strike version is the current mod.
cvar_exists - If a cvar exists returns 1, in other case 0
date - Retrieves the date.
delete_file - Deletes a file. Returns 0 on failure, 1 on success.
dir_exists - Checks if a directory exists
emit_sound - Emits sound. Sample must be precached.
engclient_cmd - This is an emulation of a client command (commands aren't send to client!).
engclient_print - Sends a message to a player through the engine.
equal - Checks if two strings are equal.
equali - Checks if two strings are equal, case insensitively.
fclose - Closes a file handle.
feof - Returns if a file handle is at the end of the file or not.
fflush - Flushes a file by file handle.
fgetc - Reads a char (1 byte) from a file handle.
fgetf - Reads a float (4 bytes, 8 on AMD64) from a file handle.
fgeti - Reads an integer (4 bytes) from a file handle.
fgetl - Reads a long (4 bytes) from a file handle.
fgets - Reads a short (2 bytes) from a file handle.
file_exists - Checks if a file exists (returns 1 on success, 0 on failure).
file_size - Returns the size of a file.
find_player - Find player
find_plugin_byfile - Finds a plugin by filename
float - Returns the floating point value of the given number.
floatabs - Returns the absolute value as a float.
floatacos - Arccosine
floatadd - Returns two floats added together, as a float.
floatasin - Arcsine
floatatan - Arctangent
floatatan2 -
floatcmp - Compares two floats.
floatcos - Returns the cosine of a value.
floatdiv - Returns a quotient as a float.
floatfract - Returns the fractional portion of a float.
floatlog - Returns the logarithm of a value. Base defaults to 10.0.
floatmul - Returns two floats multiplied, as a float.
floatpower - Returns the value raised to the power of the exponent, as a float.
floatround - Rounds a float into an integer value.
floatsin - Returns the sin of a value.
floatsqroot - Returns the square root of the value as a float.
floatstr - Converts a string into a floating point value.
floatsub - Subtract two floats as a float.
floattan - Returns the tangent of a value as a float.
float_to_str - Converts float to string
fopen - Returns a file handle for advanced file functions.
force_unmodified - Forces the client and server to be running with the same version of the specified file ( e.g., a player model )
format - Format a string with a given format and parameters.
format_args - Gets parameters from a function as a formatted string.
format_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S"
fputc - Writes a char (1 byte) to a file handle.
fputf - Writes a float (4 bytes, 8 on AMD64) to a file handle.
fputi - Writes an integer (4 bytes) to a file handle.
fputl - Writes a long (4 bytes) to a file handle.
fputs - Writes a short (2 bytes) to a file handle.
fread - Reads from a file handle.
fseek - Seeks a position in a file.
ftell - Returns the current file position pointer by file handle
funcidx - Returns the index of a named public function.
fwrite - Writes to a file handle.
getarg - Retrieve an argument from an argument list
get_array - Retrieves an array from a calling plugin.
get_array_f - Retrieves a float array from a calling plugin.
get_basedir - Outputs the AMXx basedir.
get_clcmd - Gets info about client command.
get_clcmdsnum - Returns number of registered client commands.
get_concmd - Gets info about console command.
get_concmdsnum - Returns number of registered console commands
get_configsdir - Outputs the AMXx configsdir.
get_cvar_flags - Returns a cvar flags.
get_cvar_float - Gets a cvar float
get_cvar_num - Gets a cvar integer value
get_cvar_string - Reads a cvar value
get_datadir - Outputs the AMXx datadir.
get_distance - Returns distance between two vectors.
get_distance_f - Finds the distance between two vectors
get_flags - Converts a sum of bits into a string.
get_float_byref - Returns a by-reference float from a calling plugin.
get_func_id - Returns the id of {funcName} in {plugin}
get_gametime - Returns a game time
get_localinfo - Gets an info value (
get_mapname - Returns a name of currently played map
get_maxplayers - Returns maxplayers setting
get_modname - Outputs the name of the currently played mod.
get_module - Gets info about a module.
get_modulesnum - Returns number of currently registered modules
get_param - Returns a parameter from a calling function.
get_param_byref - Returns a by-reference parameter from a calling plugin.
get_param_f - Returns a float parameter from a calling plugin.
get_players - Returns a list of player indices.
get_playersnum - Returns the number of players put in server.
get_plugin - Gets info about plugin by given index. Function returns -1 if plugin doesn't exist with given index
get_pluginsnum - Returns number of all loaded plugins.
get_srvcmd - Gets info about server command.
get_srvcmdsnum - Returns number of registered server commands
get_string - Retrieves a string from a calling plugin
get_systime - Returns system time in seconds elapsed since 00:00:00 on January 1, 1970.
get_time - Returns time in given format. The most popular is: "%m/%d/%Y - %H:%M:%S".
get_timeleft - Returns time remaining on map in seconds
get_user_aiming - Traces where a player is aiming for a maximum distance defaulted to 9999.
get_user_ammo - Stores the clip and backpack ammo amounts from a player's weapon (by index).
get_user_armor - Returns a player's armor.
get_user_attacker - Returns the index of an attacking player.
get_user_authid - Finds the authentication id of a player.
get_user_deaths - Returns a player's death count.
get_user_flags - Gets flags from player. Set index to 0 if you want to read flags from server.
get_user_frags - Returns a player's frag count
get_user_health - Gets a user's health
get_user_index - Returns a player's index (lookup by name).
get_user_info - Gets an info string from a player
get_user_ip - Returns a player's IP.
get_user_menu - Gets what menu the player is watching and what keys for menu he have.
get_user_msgid - Returns id of client message
get_user_name - Finds the name of a player.
get_user_origin - Gets a player's origin.
get_user_ping - Returns the ping and loss at the current time
get_user_team - Returns the id of a team.
get_user_time - Returns a player's playing time in seconds.
get_user_userid - Returns a player's userid.
get_user_weapon - Returns id of a player's currently carried weapon.
get_user_weapons - Returns a list of all the carried weapons of a player.
get_vaultdata - Reads a key from the vault.
get_weaponname - Stores the name of a weapon (by index) for a maximum length of len characters.
get_xvar_float - Returns a float value of a public variable. Id is a value
get_xvar_id - Returns an unique id for public variable specified by name.
get_xvar_num - Returns an integer value of a public variable
heapspace - Returns the free space on the heap.
inconsistent_file - Called on inconsistent file. You can put any text into reason to change an original message
isalnum - Returns true when value is a letter or digit.
isalpha - Returns true when value is a letter.
isdigit - Returns true when value is digit.
isspace - Returns true when value is a space character.
is_dedicated_server - Returns 1 if the server is dedicated, 0 otherwise.
is_linux_server - Returns 1 if the server is running Linux/FreeBSD, 0 if windows.
is_map_valid - Returns 1 if a map is valid, 0 otherwise.
is_module_loaded - Checks whether a module is loaded.
is_plugin_loaded - Checks whether a plugin is loaded.
is_running - Checks if the given mod is running.
is_user_admin - Checks if a user is admin.
is_user_alive - Returns 1 if a player is alive, 0 if dead.
is_user_bot - Returns 1 if a user is a bot, 0 otherwise.
is_user_connected - Returns 1 if a player is connected, 0 otherwise.
is_user_connecting - Returns 1 if a player has not yet connected, 0 otherwise.
is_user_hltv - Returns 1 if a player is an HLTV, 0 otherwise.
jit_enabled - Returns 1 if JIT is enabled, otherwise it returns 0.
log_amx - Logs something to the current AMXx logfile.
log_error - Logs an error from a dynamic native.
log_message - Logs something to the current HL log file.
log_to_file - Logs something to a specified file.
max - Returns the higher value of val1 and val2.
md5 - Calculates the md5 keysum of a string.
md5_file - Calculates the md5 keysum of a file.
menu_additem - Adds an item to a menu. When displayed, the name will be shown.
menu_create - Creates a menu.
menu_display - Displays a menu to a player.
menu_find_id - Given a page on a menu and a keypress on that page, returns the item id selected.
menu_items - Returns how many items are in a menu.
menu_item_getinfo - Gets/sets info about a menu option.
menu_item_setcall - Set the call back on an item in a menu.
menu_item_setcmd - Set a command for a given menu and item.
menu_item_setname -
menu_makecallback - Creates a menu item callback handler.
menu_pages - Returns how many pages are in a menu.
message_begin - These functinos are used to generate client messages.
message_end - Used to end a message
min - Returns the lower value of val1 and val2.
next_file - Reads the next file in a directory handle.
numargs - Returns the number of arguments passed to the current function.
num_to_str - Converts a number to a string.
num_to_word - Converts numbers from 0-999 into English words.
open_dir - Opens a directory for reading.
param_convert - Converts a parameter's address space
parse - Splits parameters into strings.
parse_loguser - Parses log data about a user.
parse_time - Returns time in input and additionaly fills missing information
pause - Pauses function or plugin so it won't be executed.
plugin_cfg - Called after plugin_init has been called
plugin_end - Called at a plugin's end
plugin_flags - Returns plugin flags
plugin_init - Forward for plugin initialization
plugin_log - Called on a log message
plugin_modules - Module check routine - DEPRECATED
plugin_natives - Called when register_native can be used.
plugin_pause - Called when the plugin is paused.
plugin_precache - Actually first called forward
plugin_unpause - Called when the plugin is unpaused.
power - Raises a value to a power.
precache_model - Precaches a model file
precache_sound - Precaches a sound file
query_client_cvar - Dispatches a client cvar query
random - Returns a pseudo-random number in the range of 0 to max-1.
random_float - Generates random floating point number from a to b
random_num - Generates random integer from a to b.
read_argc - Returns the number of parameters/arguments in a command.
read_args - Returns the entire parameter line of a command.
read_argv - Reads an argument from a command.
read_data - Gets arguments/values from client messages.
read_datanum - Returns the number of values in a client message.
read_dir - Reads content from a directory.
read_file - Reads a line from a file.
read_flags - Converts a string into a sum of bits.
read_logargc -
read_logargv - Gets a log argument.
read_logdata - Gets a log message.
register_clcmd - Registers function which will be called from client console
register_concmd - Registers function which will be called from any console
register_cvar - Registers new cvar for HL engine.
register_dictionary - Registers a dictionary file
register_event - Registers an event on which a given function will be called
register_library - Registers your plugin as a library.
register_logevent - Registers a function to be called on a log event
register_menu - Registers a menu.
register_menucmd - Calls function when player uses specified menu and proper keys.
register_menuid - Gets unique id of menu.
register_native - Declares a native that other plugins can use.
register_plugin - Sets a plugin's info
register_srvcmd - Registers function which will be called from server console.
remove_cvar_flags - const cvar[],flags = -1
remove_quotes - Removes quotes from sentence.
remove_task - Removes all tasks with given id.
remove_user_flags - Removes flags for player
remove_vaultdata - Removes a key from the vault.
replace - Replaces a contained string
require_module - Sets a requirement for a module - DEPRECATED
rewind - Resets a file's internal position (by file handle).
server_cmd - Executes command on a server console
server_exec - Forces server to execute sent server command at current time. Very useful for map changes, setting cvars and other activities.
server_print - Prints a message to the server console.
setarg - Set the value of an argument from an argument list.
setc - Sets a string with a given character.
set_array - Copies a local array into the one given by a calling plugin.
set_array_f - Copies a float array into the one given by a calling plugin.
set_cvar_flags - Sets a cvar flags (not allowed for amx_version, fun_version and sv_cheats cvars)
set_cvar_float - Sets a cvar to given float.
set_cvar_num - Sets a cvar with integer value
set_cvar_string - Sets a cvar to given value
set_error_filter - Allows you to trap error messages that occur in your plugin.
set_float_byref - Sets a float into the byreference parameter in a calling plugin.
set_hudmessage - Sets the format for a HUD message
set_localinfo - Sets info ("localinfo") on the server
set_param_byref - Sets a byreference value into the parameter given by a calling plugin.
set_string - Sets a string in a calling plugin
set_task - Calls function on specified time.
set_user_deaths - Sets a player's death count.
set_user_flags - Sets flags for player.
set_user_frags - Set's a player's frag count.
set_user_info - Sets an info value on a player
set_vaultdata - Sets a value for a key in the vault.
set_xvar_float - Sets a float value of a public variable
set_xvar_num - Sets a value of a public variable.
show_activity - Shows admin activity.
show_hudmessage - Displays a HUD message to a player
show_menu - Shows a list of menu options to a client.
show_motd - Displays an MOTD style window to a user.
sqroot - Approximates the integer square root of value.
strbreak - Gets parameters from text one at a time.
strcat - Concatenates a string.
strcmp - Compares two strings, C-style. Returns 0 on equal.
strfind - Finds a string in another string. Returns -1 if not found.
strlen - Returns the length of a zero terminated string.
strpack - Copy a string from source to dest, in packed format.
strtolower - Converts all characters in string to lower case.
strtoupper - Converts all characters in string to upper case.
strunpack - Copy a string from source to dest in unpacked format.
str_to_float - Converts a string to a float
str_to_num - Returns a string converted to a number
swapchars - Returns the value of c where all the bytes in the cell are swapped (low bye becomes high).
task_exists - Returns 1 if task under given id exists.
tickcount - Unknown
time - Retrives the time.
tolower - Returns the lower case character code of c, or if not available, returns c.
toupper - Returns the upper case character code of c, or if not available, returns c.
trim - Strips spaces from the beginning and end of a string.
ucfirst - Make a string's first character uppercase
unlink - Deletes a file.
unpause - Unpauses function or plugin.
user_has_weapon - Returns if a player has the weapon or not.
user_kill - Kills a player.
user_slap - Slaps a player for variable damage (power).
vaultdata_exists - Checks if a key exists in the vault.
write_angle - Writes an angle entry to a message.
write_byte - Writes a single byte to a message.
write_char - Writes a single character to a message.
write_coord - Writes a coordinate entry to a message.
write_entity - Writes an entity index to a message.
write_file - Writes a line to a file.
write_long - Writes a single number to a message (long).
write_short - Writes a single number to a message (short).
write_string - Writes a string to a message.
xvar_exists - Checks if public variable with given name exists in loaded plugins.
User Contributed Notes
bailopan at amxmodx dot org Jun-02-04 23:41:14
The old include for AMX Mod 0.9.x is "amxmod.inc". If you include this instead, you will also include amxmodx.inc and forward compatible stocks add AMXx compatibility to any AMX plugin.