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