plugins/include/sourcemod.inc
author Nicholas Hastings <skamonkey@gmail.com>
Sun Mar 17 11:39:04 2013 -0400 (2013-03-17)
changeset 3833 7563b32966af
parent 3743 a98686a77974
child 3967 ceafb87d38a7
permissions -rw-r--r--
Moved PCRE_STATIC def in Regex ext to extension instead of modifying pcre header (bug 5593).
     1 /**
     2  * vim: set ts=4 :
     3  * =============================================================================
     4  * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     5  * =============================================================================
     6  *
     7  * This file is part of the SourceMod/SourcePawn SDK.
     8  *
     9  * This program is free software; you can redistribute it and/or modify it under
    10  * the terms of the GNU General Public License, version 3.0, as published by the
    11  * Free Software Foundation.
    12  * 
    13  * This program is distributed in the hope that it will be useful, but WITHOUT
    14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    15  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    16  * details.
    17  *
    18  * You should have received a copy of the GNU General Public License along with
    19  * this program.  If not, see <http://www.gnu.org/licenses/>.
    20  *
    21  * As a special exception, AlliedModders LLC gives you permission to link the
    22  * code of this program (as well as its derivative works) to "Half-Life 2," the
    23  * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    24  * by the Valve Corporation.  You must obey the GNU General Public License in
    25  * all respects for all other code used.  Additionally, AlliedModders LLC grants
    26  * this exception to all derivative works.  AlliedModders LLC defines further
    27  * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    28  * or <http://www.sourcemod.net/license.php>.
    29  *
    30  * Version: $Id$
    31  */
    32 
    33 #if defined _sourcemod_included
    34  #endinput
    35 #endif
    36 #define _sourcemod_included
    37 
    38 /**
    39  * Plugin public information.
    40  */
    41 struct Plugin
    42 {
    43    const String:name[],			/**< Plugin Name */
    44    const String:description[],	/**< Plugin Description */
    45    const String:author[],		/**< Plugin Author */
    46    const String:version[],		/**< Plugin Version */
    47    const String:url[],			/**< Plugin URL */
    48 };
    49 
    50 #include <core>
    51 #include <float>
    52 #include <vector>
    53 #include <string>
    54 #include <handles>
    55 #include <functions>
    56 #include <files>
    57 #include <logging>
    58 #include <timers>
    59 #include <admin>
    60 #include <keyvalues>
    61 #include <dbi>
    62 #include <lang>
    63 #include <sorting>
    64 #include <textparse>
    65 #include <clients>
    66 #include <console>
    67 #include <events>
    68 #include <bitbuffer>
    69 #include <protobuf>
    70 #include <usermessages>
    71 #include <menus>
    72 #include <halflife>
    73 #include <adt>
    74 #include <banning>
    75 #include <commandfilters>
    76 #include <nextmap>
    77 
    78 enum APLRes
    79 {
    80 	APLRes_Success = 0,		/**< Plugin should load */
    81 	APLRes_Failure,			/**< Plugin shouldn't load and should display an error */
    82 	APLRes_SilentFailure	/**< Plugin shouldn't load but do so silently */
    83 };
    84 
    85 /**
    86  * Declare this as a struct in your plugin to expose its information.
    87  * Example:
    88  *
    89  * public Plugin:myinfo =
    90  * {
    91  *    name = "My Plugin",
    92  *    //etc
    93  * };
    94  */
    95 public Plugin:myinfo;
    96  
    97 /**
    98  * Called when the plugin is fully initialized and all known external references 
    99  * are resolved. This is only called once in the lifetime of the plugin, and is 
   100  * paired with OnPluginEnd().
   101  *
   102  * If any run-time error is thrown during this callback, the plugin will be marked 
   103  * as failed.
   104  *
   105  * It is not necessary to close any handles or remove hooks in this function.  
   106  * SourceMod guarantees that plugin shutdown automatically and correctly releases 
   107  * all resources.
   108  *
   109  * @noreturn
   110  */
   111 forward OnPluginStart();
   112 
   113 /**
   114  * @deprecated Use AskPluginLoad2() instead.
   115  * If a plugin contains both AskPluginLoad() and AskPluginLoad2(), the former will
   116  * not be called, but old plugins with only AskPluginLoad() will work.
   117  */
   118 #pragma deprecated Use AskPluginLoad2() instead
   119 forward bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max);
   120 
   121 /**
   122  * Called before OnPluginStart, in case the plugin wants to check for load failure.
   123  * This is called even if the plugin type is "private."  Any natives from modules are 
   124  * not available at this point.  Thus, this forward should only be used for explicit 
   125  * pre-emptive things, such as adding dynamic natives, setting certain types of load 
   126  * filters (such as not loading the plugin for certain games).
   127  * 
   128  * @note It is not safe to call externally resolved natives until OnPluginStart().
   129  * @note Any sort of RTE in this function will cause the plugin to fail loading.
   130  * @note If you do not return anything, it is treated like returning success. 
   131  * @note If a plugin has an AskPluginLoad2(), AskPluginLoad() will not be called.
   132  *
   133  *
   134  * @param myself	Handle to the plugin.
   135  * @param late		Whether or not the plugin was loaded "late" (after map load).
   136  * @param error		Error message buffer in case load failed.
   137  * @param err_max	Maximum number of characters for error message buffer.
   138  * @return			APLRes_Success for load success, APLRes_Failure or APLRes_SilentFailure otherwise
   139  */
   140 forward APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max);
   141 
   142 /**
   143  * Called when the plugin is about to be unloaded.
   144  *
   145  * @noreturn
   146  */
   147 forward OnPluginEnd();
   148 
   149 /**
   150  * Called when the plugin's pause status is changing.
   151  *
   152  * @param pause			True if the plugin is being paused, false otherwise.
   153  * @noreturn
   154  */
   155 forward OnPluginPauseChange(bool:pause);
   156 
   157 /**
   158  * Called before every server frame.  Note that you should avoid
   159  * doing expensive computations here, and you should declare large
   160  * local arrays using 'decl' instead of 'new'.
   161  */
   162 forward OnGameFrame();
   163 
   164 /**
   165  * Called when the map is loaded.
   166  *
   167  * @note This used to be OnServerLoad(), which is now deprecated.
   168  * Plugins still using the old forward will work.
   169  */
   170 forward OnMapStart();
   171 
   172 /**
   173  * Called right before a map ends.
   174  */
   175 forward OnMapEnd();
   176 
   177 /**
   178  * Called when the map has loaded, servercfgfile (server.cfg) has been 
   179  * executed, and all plugin configs are done executing.  This is the best
   180  * place to initialize plugin functions which are based on cvar data.  
   181  *
   182  * @note This will always be called once and only once per map.  It will be 
   183  * called after OnMapStart().
   184  *
   185  * @noreturn
   186  */
   187 forward OnConfigsExecuted();
   188 
   189 /**
   190  * This is called once, right after OnMapStart() but any time before 
   191  * OnConfigsExecuted().  It is called after the "exec sourcemod.cfg" 
   192  * command and all AutoExecConfig() exec commands have been added to 
   193  * the ServerCommand() buffer.
   194  *
   195  * If you need to load per-map settings that override default values, 
   196  * adding commands to the ServerCommand() buffer here will guarantee 
   197  * that they're set before OnConfigsExecuted().
   198  *
   199  * Unlike OnMapStart() and OnConfigsExecuted(), this is not called on 
   200  * late loads that occur after OnMapStart().
   201  *
   202  * @noreturn
   203  */
   204 forward OnAutoConfigsBuffered();
   205 
   206 /**
   207  * @deprecated Use OnConfigsExecuted() instead.
   208  */
   209 #pragma deprecated Use OnConfigsExecuted() instead
   210 forward OnServerCfg();
   211 
   212 /**
   213  * Called after all plugins have been loaded.  This is called once for 
   214  * every plugin.  If a plugin late loads, it will be called immediately 
   215  * after OnPluginStart().
   216  */
   217 forward OnAllPluginsLoaded();
   218 
   219 /**
   220  * Returns the calling plugin's Handle.
   221  *
   222  * @return				Handle of the calling plugin.
   223  */
   224 native Handle:GetMyHandle();
   225 
   226 /**
   227  * Returns an iterator that can be used to search through plugins.
   228  *
   229  * @return				Handle to iterate with.  Must be closed via 
   230  * 						CloseHandle().
   231  * @error				Invalid Handle.
   232  */
   233 native Handle:GetPluginIterator();
   234 
   235 /**
   236  * Returns whether there are more plugins available in the iterator.
   237  *
   238  * @param iter			Handle to the plugin iterator.
   239  * @return				True on more plugins, false otherwise.
   240  * @error				Invalid Handle.
   241  */
   242 native bool:MorePlugins(Handle:iter);
   243 
   244 /**
   245  * Returns the current plugin in the iterator and advances the iterator.
   246  *
   247  * @param iter			Handle to the plugin iterator.
   248  * @return				Current plugin the iterator is at, before
   249  *						the iterator is advanced.
   250  * @error				Invalid Handle.
   251  */
   252 native Handle:ReadPlugin(Handle:iter);
   253 
   254 /**
   255  * Returns a plugin's status.
   256  *
   257  * @param plugin		Plugin Handle (INVALID_HANDLE uses the calling plugin).
   258  * @return				Status code for the plugin.
   259  * @error				Invalid Handle.
   260  */
   261 native PluginStatus:GetPluginStatus(Handle:plugin);
   262 
   263 /**
   264  * Retrieves a plugin's file name relative to the plugins folder.
   265  *
   266  * @param plugin		Plugin Handle (INVALID_HANDLE uses the calling plugin).
   267  * @param buffer		Buffer to the store the file name.
   268  * @param maxlength		Maximum length of the name buffer.
   269  * @noreturn
   270  * @error				Invalid Handle.
   271  */
   272 native GetPluginFilename(Handle:plugin, String:buffer[], maxlength);
   273 
   274 /**
   275  * Retrieves whether or not a plugin is being debugged.
   276  *
   277  * @param plugin		Plugin Handle (INVALID_HANDLE uses the calling plugin).
   278  * @return				True if being debugged, false otherwise.
   279  * @error				Invalid Handle.
   280  */
   281 native bool:IsPluginDebugging(Handle:hndl);
   282 
   283 /**
   284  * Retrieves a plugin's public info.
   285  *
   286  * @param plugin		Plugin Handle (INVALID_HANDLE uses the calling plugin).
   287  * @param info			Plugin info property to retrieve.
   288  * @param buffer		Buffer to store info in.
   289  * @param maxlength		Maximum length of buffer.
   290  * @return				True on success, false if property is not available.
   291  * @error				Invalid Handle.
   292  */
   293 native bool:GetPluginInfo(Handle:plugin, PluginInfo:info, String:buffer[], maxlength);
   294 
   295 /**
   296  * Finds a plugin by its order in the list from the "plugins list" server 
   297  * "sm" command.  You should not use this function to loop through all plugins, 
   298  * use the iterator instead.  Looping through all plugins using this native 
   299  * is O(n^2), whereas using the iterator is O(n).
   300  *
   301  * @param order_num		Number of the plugin as it appears in "sm plugins list".
   302  * @return				Plugin Handle on success, INVALID_HANDLE if no plugin 
   303  *						matches the given number.
   304  */
   305 native Handle:FindPluginByNumber(order_num);
   306 
   307 /**
   308  * Causes the plugin to enter a failed state.  An error will be thrown and
   309  * the plugin will be paused until it is unloaded or reloaded.
   310  *
   311  * For backwards compatibility, if no extra arguments are passed, no 
   312  * formatting is applied.  If one or more additional arguments is passed, 
   313  * the string is formatted using Format().  If any errors are encountered 
   314  * during formatting, both the format specifier string and an additional 
   315  * error message are written.
   316  *
   317  * This function does not return, and no further code in the plugin is 
   318  * executed.
   319  *
   320  * @param string		Format specifier string.
   321  * @param ...			Formatting arguments.
   322  * @noreturn
   323  * @error				Always throws SP_ERROR_ABORT.
   324  */
   325 native SetFailState(const String:string[], any:...);
   326 
   327 /**
   328  * Aborts the current callback and throws an error.  This function
   329  * does not return in that no code is executed following it.
   330  *
   331  * @param format		String format.
   332  * @param ...			Format arguments.
   333  * @noreturn
   334  * @error				Always!
   335  */
   336 native ThrowError(const String:fmt[], any:...);
   337 
   338 /**
   339  * Gets the system time as a unix timestamp.
   340  *
   341  * @param bigStamp		Optional array to store the 64bit timestamp in.
   342  * @return				32bit timestamp (number of seconds since unix epoch).
   343  */
   344 native GetTime(bigStamp[2]={0,0});
   345 
   346 /**
   347  * Produces a date and/or time string value for a timestamp.
   348  *
   349  * See this URL for valid parameters: 
   350  * http://cplusplus.com/reference/clibrary/ctime/strftime.html
   351  *
   352  * @param buffer		Destination string buffer.
   353  * @param maxlength		Maximum length of output string buffer.
   354  * @param format		Formatting rules (passing NULL_STRING will use the rules defined in sm_datetime_format).
   355  * @param stamp			Optional time stamp.
   356  * @noreturn
   357  * @error			Buffer too small or invalid time format.
   358  */
   359 native FormatTime(String:buffer[], maxlength, const String:format[], stamp=-1);
   360 
   361 /**
   362  * Loads a game config file.
   363  *
   364  * @param file			File to load.  The path must be relative to the 'gamedata' folder under the config folder 
   365  *					and the extension should be omitted.
   366  * @return			A handle to the game config file or INVALID_HANDLE in failure.
   367  */
   368 native Handle:LoadGameConfigFile(const String:file[]);
   369 
   370 /**
   371  * Returns an offset value.
   372  *
   373  * @param gc			Game config handle.
   374  * @param key			Key to retrieve from the offset section.
   375  * @return			An offset, or -1 on failure.
   376  */
   377 native GameConfGetOffset(Handle:gc, const String:key[]);
   378 
   379 /**
   380  * Gets the value of a key from the "Keys" section.
   381  *
   382  * @param gc			Game config handle.
   383  * @param key			Key to retrieve from the Keys section.
   384  * @param buffer		Destination string buffer.
   385  * @param maxlen		Maximum length of output string buffer.
   386  * @return				True if key existed, false otherwise.
   387  */
   388 native bool:GameConfGetKeyValue(Handle:gc, const String:key[], String:buffer[], maxlen);
   389 
   390 /*
   391  * Finds an address calculation in a GameConfig file,
   392  * performs LoadFromAddress on it as appropriate, then returns the final address.
   393  *
   394  * @param gameconf      GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt.
   395  * @param name          Name of the property to find.
   396  * @return              An address calculated on success, or 0 on failure.
   397  */
   398 native Address:GameConfGetAddress(Handle:gameconf, const String:name[]);
   399 
   400 /**
   401  * Returns the operating system's "tick count," which is a number of 
   402  * milliseconds since the operating system loaded.  This can be used
   403  * for basic benchmarks.
   404  *
   405  * @return				Tick count in milliseconds.
   406  */
   407 native GetSysTickCount();
   408 
   409 /**
   410  * Specifies that the given config file should be executed after plugin load.
   411  * OnConfigsExecuted() will not be called until the config file has executed, 
   412  * but it will be called if the execution fails.
   413  *
   414  * @param autoCreate	If true, and the config file does not exist, such a config
   415  *						file will be automatically created and populated with
   416  *						information from the plugin's registered cvars.
   417  * @param name			Name of the config file, excluding the .cfg extension.
   418  *						If empty, <plugin.filename.cfg> is assumed.
   419  * @param folder		Folder under cfg/ to use.  By default this is "sourcemod."
   420  * @noreturn
   421  */
   422 native AutoExecConfig(bool:autoCreate=true, const String:name[]="", const String:folder[]="sourcemod");
   423 
   424 /**
   425  * Registers a library name for identifying as a dependency to 
   426  * other plugins.
   427  *
   428  * @param name			Library name.
   429  * @noreturn
   430  */
   431 native RegPluginLibrary(const String:name[]);
   432 
   433 /**
   434  * Returns whether a library exists.  This function should be considered 
   435  * expensive; it should only be called on plugin to determine availability 
   436  * of resources.  Use OnLibraryAdded()/OnLibraryRemoved() to detect changes 
   437  * in optional resources.
   438  *
   439  * @param name			Library name of a plugin or extension.
   440  * @return				True if exists, false otherwise.
   441  */
   442 native bool:LibraryExists(const String:name[]);
   443 
   444 /**
   445  * Returns the status of an extension, by filename.
   446  *
   447  * @param name			Extension name (like "sdktools.ext").
   448  * @param error			Optional error message buffer.
   449  * @param maxlength		Length of optional error message buffer.
   450  * @return				-2 if the extension was not found.
   451  *						-1 if the extension was found but failed to load.
   452  * 						 0 if the extension loaded but reported an error.
   453  * 						 1 if the extension is running without error.
   454  */
   455 native GetExtensionFileStatus(const String:name[], String:error[]="", maxlength=0);
   456 
   457 /**
   458  * Called after a library is added that the current plugin references 
   459  * optionally. A library is either a plugin name or extension name, as 
   460  * exposed via its include file.
   461  *
   462  * @param name			Library name.
   463  */
   464 forward OnLibraryAdded(const String:name[]);
   465 
   466 /**
   467  * Called right before a library is removed that the current plugin references 
   468  * optionally.  A library is either a plugin name or extension name, as 
   469  * exposed via its include file.
   470  *
   471  * @param name			Library name.
   472  */
   473 forward OnLibraryRemoved(const String:name[]);
   474 
   475 #define MAPLIST_FLAG_MAPSFOLDER		(1<<0)		/**< On failure, use all maps in the maps folder. */
   476 #define MAPLIST_FLAG_CLEARARRAY		(1<<1)		/**< If an input array is specified, clear it before adding. */
   477 #define MAPLIST_FLAG_NO_DEFAULT		(1<<2)		/**< Do not read "default" or "mapcyclefile" on failure. */
   478 
   479 /**
   480  * Loads a map list to an ADT Array.
   481  *
   482  * A map list is a list of maps from a file.  SourceMod allows easy configuration of 
   483  * maplists through addons/sourcemod/configs/maplists.cfg.  Each entry is given a 
   484  * name and a file (for example, "rtv" => "rtv.cfg"), or a name and a redirection 
   485  * (for example, "rtv" => "default").  This native will read a map list entry, 
   486  * cache the file, and return the list of maps it holds.  
   487  *
   488  * Serial change numbers are used to identify if a map list has changed.  Thus, if 
   489  * you pass a serial change number and it's equal to what SourceMod currently knows 
   490  * about the map list, then SourceMod won't reparse the file.
   491  *
   492  * If the maps end up being read from the maps folder (MAPLIST_FLAG_MAPSFOLDER), they 
   493  * are automatically sorted in alphabetical, ascending order.
   494  *
   495  * Arrays created by this function are temporary and must be freed via CloseHandle().
   496  * Modifying arrays created by this function will not affect future return values or 
   497  * or the contents of arrays returned to other plugins.
   498  *
   499  * @param array			Array to store the map list.  If INVALID_HANDLE, a new blank 
   500  *						array will be created.  The blocksize should be at least 16; 
   501  *						otherwise results may be truncated.  Items are added to the array 
   502  *						as strings.  The array is never checked for duplicates, and it is 
   503  *						not read beforehand.  Only the serial number is used to detect 
   504  *						changes.
   505  * @param serial		Serial number to identify last known map list change.  If -1, the 
   506  *						the value will not be checked.  If the map list has since changed, 
   507  *						the serial is updated (even if -1 was passed).  If there is an error 
   508  *						finding a valid maplist, then the serial is set to -1.
   509  * @param str			Config name, or "default" for the default map list.  Config names 
   510  *						should be somewhat descriptive.  For example, the admin menu uses 
   511  *						a config name of "admin menu".  The list names can be configured 
   512  *						by users in addons/sourcemod/configs/maplists.cfg.
   513  * @param flags			MAPLIST_FLAG flags.
   514  * @return				On failure:
   515  *						 INVALID_HANDLE is returned, the serial is set to -1, and the input 
   516  *						 array (if any) is left unchanged.
   517  *						On no change:
   518  						 INVALID_HANDLE is returned, the serial is unchanged, and the input 
   519  						 array (if any) is left unchanged.
   520  *						On success:
   521  *						 A valid array Handle is returned, containing at least one map string.  
   522  *						 If an array was passed, the return value is equal to the passed Array 
   523  *						 Handle.  If the passed array was not cleared, it will have grown by at 
   524  *						 least one item.  The serial number is updated to a positive number.
   525  * @error				Invalid array Handle that is not INVALID_HANDLE.
   526  */
   527 native Handle:ReadMapList(Handle:array=INVALID_HANDLE,
   528 						  &serial=-1,
   529 						  const String:str[]="default",
   530 						  flags=MAPLIST_FLAG_CLEARARRAY);
   531 						  
   532 /**
   533  * Makes a compatibility binding for map lists.  For example, if a function previously used 
   534  * "clam.cfg" for map lists, this function will insert a "fake" binding to "clam.cfg" that 
   535  * will be overridden if it's in the maplists.cfg file.
   536  *
   537  * @param name			Configuration name that would be used with ReadMapList().
   538  * @param file			Default file to use.
   539  * @noreturn
   540  */
   541 native SetMapListCompatBind(const String:name[], const String:file[]);
   542 
   543 /**
   544  * Called when a client has sent chat text.  This must return either true or 
   545  * false to indicate that a client is or is not spamming the server.
   546  *
   547  * The return value is a hint only.  Core or another plugin may decide 
   548  * otherwise.
   549  *
   550  * @param client		Client index.  The server (0) will never be passed.
   551  * @return				True if client is spamming the server, false otherwise.
   552  */
   553 forward bool:OnClientFloodCheck(client);
   554 
   555 /**
   556  * Called after a client's flood check has been computed.  This can be used 
   557  * by antiflood algorithms to decay/increase flooding weights.
   558  *
   559  * Since the result from "OnClientFloodCheck" isn't guaranteed to be the 
   560  * final result, it is generally a good idea to use this to play with other 
   561  * algorithms nicely.
   562  *
   563  * @param client		Client index.  The server (0) will never be passed.
   564  * @param blocked		True if client flooded last "say", false otherwise.
   565  * @noreturn
   566  */
   567 forward OnClientFloodResult(client, bool:blocked);
   568 
   569 /**
   570  * Feature types.
   571  */
   572 enum FeatureType
   573 {
   574 	/**
   575 	 * A native function call.
   576 	 */
   577 	FeatureType_Native,
   578 	
   579 	/**
   580 	 * A named capability. This is distinctly different from checking for a
   581 	 * native, because the underlying functionality could be enabled on-demand
   582 	 * to improve loading time. Thus a native may appear to exist, but it might
   583 	 * be part of a set of features that are not compatible with the current game
   584 	 * or version of SourceMod.
   585 	 */
   586 	FeatureType_Capability
   587 };
   588 
   589 /**
   590  * Feature statuses.
   591  */
   592 enum FeatureStatus
   593 {
   594 	/**
   595 	 * Feature is available for use.
   596 	 */
   597 	FeatureStatus_Available,
   598 	
   599 	/**
   600 	 * Feature is not available.
   601 	 */
   602 	FeatureStatus_Unavailable,
   603 	
   604 	/**
   605 	 * Feature is not known at all.
   606 	 */
   607 	FeatureStatus_Unknown
   608 };
   609 
   610 /**
   611  * Returns whether "GetFeatureStatus" will work. Using this native
   612  * or this function will not cause SourceMod to fail loading on older versions,
   613  * however, GetFeatureStatus will only work if this function returns true.
   614  *
   615  * @return              True if GetFeatureStatus will work, false otherwise.
   616  */
   617 stock bool:CanTestFeatures()
   618 {
   619 	return LibraryExists("__CanTestFeatures__");
   620 }
   621 
   622 /**
   623  * Returns whether a feature exists, and if so, whether it is usable.
   624  *
   625  * @param type          Feature type.
   626  * @param name          Feature name.
   627  * @return              Feature status.
   628  */
   629 native FeatureStatus:GetFeatureStatus(FeatureType:type, const String:name[]);
   630 
   631 /**
   632  * Requires that a given feature is available. If it is not, SetFailState()
   633  * is called with the given message.
   634  *
   635  * @param type          Feature type.
   636  * @param name          Feature name.
   637  * @param fmt           Message format string, or empty to use default.
   638  * @param ...           Message format parameters, if any.
   639  * @noreturn
   640  */
   641 native RequireFeature(FeatureType:type, const String:name[],
   642                       const String:fmt[]="", any:...);
   643 
   644 /**
   645  * Represents how many bytes we can read from an address with one load
   646  */
   647 enum NumberType
   648 {
   649     NumberType_Int8,
   650     NumberType_Int16,
   651     NumberType_Int32
   652 };
   653 
   654 enum Address
   655 {
   656     Address_Null = 0,              //a typical invalid result when an address lookup fails
   657     Address_MinimumValid = 0x10000 //addresses below this value are considered invalid to use for Load/Store
   658 };
   659 
   660 /**
   661  * Load up to 4 bytes from a memory address.
   662  *
   663  * @param addr          Address to a memory location.
   664  * @param size          How many bytes should be read.
   665  * @return              The value that is stored at that address.
   666  */
   667 native LoadFromAddress(Address:addr, NumberType:size);
   668 
   669 /**
   670  * Store up to 4 bytes to a memory address.
   671  *
   672  * @param addr          Address to a memory location.
   673  * @param data          Value to store at the address.
   674  * @param size          How many bytes should be written.
   675  * @noreturn
   676  */
   677 native StoreToAddress(Address:addr, data, NumberType:size); 
   678 
   679 #include <helpers>
   680 #include <entity>
   681 #include <entity_prop_stocks>
   682