3. Module Function Reference

	REAL	amx_ctof( cell x );
Converts a cell to a REAL (float or double) value.

	REAL	amx_ftoc( float x );
Converts a REAL (float or double) to a cell value.

	int	MF_AddNatives( const AMX_NATIVE_INFO *list );
Adds an array of natives to the AMX Mod X core. Returns 1 for success and 0 for failure.

	int	MF_AmxAllot( AMX *amx, int cells, cell *amxAddr, cell **physAddr );
Allocates memory in an AMX plugin, returning AMX_ERR_NONE on success. AmxAddr will contain the AMX offset and physAddr will contain the physical address.

	int	MF_AmxExec( AMX *amx, cell *retval, int index );
Executes a public function by index on a specific plugin. The return code for the machine state is returned, and the actual plugin return value is stored in the cell pointed to by retval.

	int	MF_AmxExecv( AMX *amx, cell *retval, int index, int numparams, cell params[] );
This function is deprecated and is no longer usable.

	int	MF_AmxFindNative( AMX *amx, const char *name, int *index );
Same as MF_AmxFindPublic, except returns the index of a native instead of a public function.

	int	MF_AmxFindPublic( AMX *amx, const char *name, int *index );
Finds a public function by name in a specific plugin. The function index is stored in the integer pointed to by index. On success, AMX_ERR_NONE is returned, otherwise AMX_ERR_NOTFOUND is returned.

	char*	MF_BuildPathname( const char *format, ... );
Formats a series of strings in the style of sprintf(), converting the path tokens for the current operating system. The return pointer is a static buffer, currently set to 256 bytes.

	char*	MF_BuildPathnameR( char *buffer, size_t maxlength, const char *format, ... );
Same as MF_BuildPathname, but re-entrant. Recommended usage over its predecessor.

	void	MF_CopyAmxMemory( cell *dest, const cell *src, int len);
Copies a segment of memory from src to dest. Length is in cells, not bytes.

	int	MF_ExecuteForward( int id, ... );
Executes a given forward (valid IDs are > -1). Each variable argument parameter must match the constructs used with MF_RegisterForward style functions.

	int	MF_FindScriptByAmx( const AMX *amx );
Returns the integer id of an AMX Mod X loaded plugin matching the given AMX pointer.

	int	MF_FindScriptByName( const char *name );
Returns the integer id of an AMX Mod X loaded plugin matching the given file name.

	const char * MF_Format( const char *format, ... );


Formats a string using the Language Translator in the AMX Mod X core.

	char*	MF_FormatAmxString( AMX *amx, cell *params, int bufferId, int *len);
Formats a string using the parameters of a native call. You should always pass the params array directly, because the function expects the first cell to contain the parameter count. This function contains two buffer slots, 0 and 1. The return value is a pointer from one of these static buffers. The length of the final string is stored in the integer pointed to by "len".

	cell*	MF_GetAmxAddr( AMX *amx, cell offset );
Returns the cell address of a parameter passed by reference, such as a variable argument, byref parameter, string, or array.

	char*	MF_GetAmxString( AMX *amx, cell amxAddr, int bufferId, int *len );
Returns a null-terminated string constructed from an amx by-reference address. The pointer is to one of four buffer slots, 0-3. The length of the string is stored in the integer pointed to by "len".

	int	MF_GetAmxStringLen( const cell *ptr );
Returns the length of a string stored as an array of cells (for example, a result from MF_GetAmxAddr()).

	const char*	MF_GetModname();

Returns a string containing the mod name.

	int	MF_GetPlayerArmor( int playerId );
Returns the armorvalue of a player by id.

	int	MF_GetPlayerCurweapon( int playerId );
Returns the id of the current weapon of a player by id.

	int	MF_GetPlayerDeaths( int playerId );
Returns the death count of a player by id.

	int	MF_GetPlayerEdict( int playerId );
Returns the edict_t pointer of a player by id.

int MF_GetPlayerFlags( int playerId );

Returns the flags set on player flag slot 0 by id.

	int	MF_GetPlayerFrags( int playerId );
Returns the amount of frags of a player by id.

	int	MF_GetPlayerHealth( int playerId );
Returns the health of a player by id.

	const char *	MF_GetPlayerIP( int playerId );

Returns a string containing a player's IP address by id.

	int	MF_GetPlayerKeys( int playerId );
Returns a player's keys by id.

	int	MF_GetPlayerMenu( int playerId );
Returns a player's current menu by id.

	const char *	MF_GetPlayerName( int playerId );

Returns a player's name by id.

	float	MF_GetPlayerPlayTime( int playerId );
Returns a player's playtime by id.

	const char *	MF_GetPlayerTeam( int playerId );

Returns a player's team name by id.

	int	MF_GetPlayerTeamID( int playerId );
Returns a player's team id by id.

	float	MF_GetPlayerTime( int playerId );
Returns a player's total time by id.

	AMX*	MF_GetScriptAmx( int id );
Returns a plugin's AMX structure by id.

	AMX*	MF_GetScriptName( const char *name );
Returns a plugin's AMX structure by name.

	int	MF_IsPlayerAlive( int id );
Returns 1 if a player is alive, 0 otherwise.

	int	MF_IsPlayerAuthorized( int id );
Returns 1 if a player is Steam authorized, 0 otherwise.

	int	MF_IsPlayerBot( int id );
Returns 1 if a player is a bot/fakeclient, 0 otherwise.

	int	MF_IsPlayerConnecting( int id );
Returns 1 if a player is still connecting, 0 otherwise.

	int	MF_IsPlayerHLTV( int id );
Returns 1 if a player is an HLTV, 0 otherwise.

	int	MF_IsPlayerIngame( int id );
Returns 1 if a player is in-game, 0 otherwise.

	int	MF_IsPlayerValid( int id );
Returns 1 if a player id is a valid id, 0 otherwise.

	void	MF_Log( const char *format, ... );
Logs a message in the style of sprintf() to Half-Life. The module's name is prepended in the style of Metamod.

	void	MF_LogError( AMX *amx, int err, const char *format, ... );
Logs a message using the generic error messenger (debug tracer). The error code should usually be AMX_ERR_NATIVE, and format is in the style of sprintf(). If you use this, you should not use MF_RaiseAmxError().

	cell	MF_PrepareCellArray( cell *ptr, unsigned int size );
	cell	MF_PrepareCellArrayA( cell *ptr, unsigned int size, bool copyBack);
Allocates memory for a cell array for a forward. The AMX address offset is returned as a cell. If copyBack is true, any data changed in the array after the forward is executed is copied back to the original AMX address.

	cell	MF_PrepareCharArray( char *ptr, unsigned int size );
	cell	MF_PrepareCharArrayA( char *ptr, unsigned int size, bool copyBack );
Same as PrepareCellArray, except the source is a null terminated string instead of a cell array.

	void	MF_PrintSrvConsole( char *format, ... );
Prints text in the style of sprintf() to the server console.

	int	MF_RaiseAmxError( AMX *amx, int error );
Obsolete - use MF_LogError() instead. Sets the error state in an AMX instance which will halt the machine and invoke a generic error message.

	void	MF_RegisterFunction( void *pfn, const char *name );
Registers a function in the module funciton table, for use with MF_RequestFunction.

	int	MF_RegisterForward( const char *funcname, ForwardExecType exectype, ... );
Registers a global forward throughout all plugins. "funcname" is the name of the function which must be public. ForwardExecType is either ET_STOP (halt on PLUGIN_HANDLED) or ET_IGNORE (ignore return value). The rest of the parameters should be an FP_DONE terminated list of parameter types, which are: FP_CELL (normal), FP_FLOAT (float), FP_STRING (null terminated string), FP_STRINGEX (copy back string), FP_ARRAY (use the return value of PrepareCellArray). The return value is the identifier which should be used with MF_ExecuteForward.

	int	MF_RegisterSPForward( AMX *amx, int func, ... );
	int	MF_RegisterSPForwardByName( AMX *amx, const char *func, ... );
Registers a forward to a public function in a single plugin. Note that there is no ExecType value, as it is unnecessary. The return value is the identifier which should be used with MF_ExecuteForward. The integer func should be the value of MF_AmxFindPublic(), or use the function which registers by function name.

	void *	MF_RequestFunction( const char *name );
Requests a function from the module function table.

	int	MF_SetAmxString( AMX *amx, cell amxAddr, const char *src, int max );
Sets an AMX string. amxAddr should be an AMX offset that points to an array. Max is the maximum number of cells to copy.

	void	MF_UnregisterSPForward( int id );
Unregisters a previously registered forward.