2015-01-16 22:14:15 +00:00
|
|
|
// vim: set ts=4 sw=4 tw=99 noet:
|
|
|
|
//
|
|
|
|
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
|
|
// Copyright (C) The AMX Mod X Development Team.
|
|
|
|
//
|
|
|
|
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
|
|
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
|
|
// https://alliedmods.net/amxmodx-license
|
|
|
|
|
|
|
|
#if defined _cvars_included
|
2015-02-24 21:51:36 +00:00
|
|
|
#endinput
|
2015-01-16 22:14:15 +00:00
|
|
|
#endif
|
|
|
|
#define _cvars_included
|
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* CVAR flags for create_cvar() and register_cvar().
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
2015-02-20 14:35:06 +00:00
|
|
|
#define FCVAR_NONE 0 // No special behavior
|
|
|
|
#define FCVAR_ARCHIVE 1 // Cvar will be saved to vars.rc Set to cause it to be saved to vars.rc
|
|
|
|
#define FCVAR_USERINFO 2 // Cvar changes the client's info string
|
|
|
|
#define FCVAR_SERVER 4 // Clients get notified when cvar value is changed
|
|
|
|
#define FCVAR_EXTDLL 8 // Defined by an external DLL
|
|
|
|
#define FCVAR_CLIENTDLL 16 // Defined by the client DLL
|
|
|
|
#define FCVAR_PROTECTED 32 // Cvar value is masked from outside access, should be used for sensitive cvars like passwords
|
|
|
|
#define FCVAR_SPONLY 64 // Cvar can't be changed by clients connected to a multiplayer server
|
|
|
|
#define FCVAR_PRINTABLEONLY 128 // The cvar string value can not contain unprintable characters
|
|
|
|
#define FCVAR_UNLOGGED 256 // If the cvar is FCVAR_SERVER, don't log changes to a file/the console
|
|
|
|
#define FCVAR_NOEXTRAWHITEPACE 512 // Automatically strips trailing/leading white space from the string value
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cvar bound constants used with [get|set]_pcvar_bounds().
|
|
|
|
*/
|
|
|
|
enum CvarBounds
|
|
|
|
{
|
2015-02-24 21:51:36 +00:00
|
|
|
CvarBound_Upper = 0,
|
|
|
|
CvarBound_Lower
|
2015-02-20 14:35:06 +00:00
|
|
|
};
|
2015-01-21 22:58:01 +00:00
|
|
|
|
2015-01-22 23:58:57 +00:00
|
|
|
/**
|
|
|
|
* Creates a new cvar for the engine.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note This has the same effect as register_cvar() but provides more options.
|
2015-01-22 23:58:57 +00:00
|
|
|
* @note For a list of possible cvar flags see FCVAR_* constants above.
|
|
|
|
* @note If an already existing cvar is registered it will not be duplicated.
|
2015-02-20 14:35:06 +00:00
|
|
|
* The default value is only set when the cvar is registered for the very
|
|
|
|
* first time since the server was started. Cvar bounds are overwritten
|
|
|
|
* by the create_cvar() call just as if they were re-set using
|
|
|
|
* set_pcvar_bounds().
|
2015-01-22 23:58:57 +00:00
|
|
|
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
|
|
* set_pcvar_* set of functions.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param name Cvar name
|
|
|
|
* @param string Default cvar value
|
|
|
|
* @param flags Optional bitsum of flags specifying cvar behavior
|
|
|
|
* @param description Optional description of the cvar
|
|
|
|
* @param has_min Optional boolean that specifies if the cvar has a
|
|
|
|
* minimum value
|
|
|
|
* @param min_val Minimum floating point value
|
|
|
|
* @param has_max Optional boolean that specifies if the cvar has a
|
|
|
|
* maximum value
|
|
|
|
* @param max_val Maximum floating point value
|
|
|
|
*
|
|
|
|
* @return Unique cvar pointer
|
|
|
|
* @error If invalid bounds are provided (min_val > max_val or
|
|
|
|
* vice versa), an error will be thrown.
|
2015-01-22 23:58:57 +00:00
|
|
|
*/
|
2015-01-25 10:38:01 +00:00
|
|
|
native create_cvar(const name[], const string[], flags = FCVAR_NONE, const description[] = "", bool:has_min = false, Float:min_val = 0.0, bool:has_max = false, Float:max_val = 0.0);
|
2015-01-22 23:58:57 +00:00
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
|
|
|
* Registers a new cvar for the engine.
|
|
|
|
*
|
2015-01-22 23:58:57 +00:00
|
|
|
* @note Deprecated. Consider to use create_cvar for more options.
|
2015-01-21 22:58:01 +00:00
|
|
|
* @note For a list of possible cvar flags see FCVAR_* constants in amxconst.inc
|
|
|
|
* @note If an already existing cvar is registered it will not be duplicated.
|
2015-02-20 14:35:06 +00:00
|
|
|
* The default value is only set when the cvar is registered for the very
|
|
|
|
* first time since the server was started.
|
2015-01-21 22:58:01 +00:00
|
|
|
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
|
|
* set_pcvar_* set of functions.
|
|
|
|
*
|
|
|
|
* @param name Cvar name
|
|
|
|
* @param string Default cvar value
|
2015-01-29 20:44:53 +00:00
|
|
|
* @param flags Optional bitsum of flags specifying cvar behavior
|
2015-01-21 22:58:01 +00:00
|
|
|
* @param fvalue Unused
|
|
|
|
*
|
|
|
|
* @return Unique cvar pointer
|
|
|
|
*/
|
2015-02-20 14:35:06 +00:00
|
|
|
native register_cvar(const name[], const string[], flags = FCVAR_NONE, Float:fvalue = 0.0);
|
2015-01-21 22:58:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a cvar is registered on the server.
|
|
|
|
*
|
|
|
|
* @param cvar Cvar name to check
|
|
|
|
*
|
|
|
|
* @return 1 if the cvar exists, 0 otherwise
|
|
|
|
*/
|
|
|
|
native cvar_exists(const cvar[]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the cvar pointer of the specified cvar.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note A pointer is also returned by register_cvar() and create_cvar().
|
|
|
|
* Plugins can (and should) retrieve and use pointers for already existing
|
|
|
|
* mod cvars.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to find
|
|
|
|
*
|
|
|
|
* @return Cvar pointer on success, 0 if cvar was not found
|
|
|
|
*/
|
|
|
|
native get_cvar_pointer(const cvar[]);
|
|
|
|
|
2015-01-16 22:14:15 +00:00
|
|
|
/**
|
2015-01-24 20:28:43 +00:00
|
|
|
* Creates a hook for when a cvar's value is changed.
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-01-29 20:44:53 +00:00
|
|
|
* @note Changing the cvar value from within this forward can lead to infinite
|
|
|
|
* recursion and should be avoided.
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note The callback will be called in the following manner:
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* public cvar_change_callback(pcvar, const old_value[], const new_value[])
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* pcvar - Pointer to cvar that was changed
|
|
|
|
* old_value - Buffer containing the previous value of the cvar
|
|
|
|
* new_value - Buffer containing the new value of the cvar
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* The return value is ignored
|
2015-01-29 20:44:53 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param pcvar Pointer to cvar
|
|
|
|
* @param callback Name of callback function
|
2015-01-29 20:44:53 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @return Callback handle that can be used with
|
|
|
|
* [disable|enable]_cvar_hook
|
|
|
|
* @error If an invalid cvar pointer or callback function is provided,
|
|
|
|
* an error will be thrown.
|
2015-01-21 19:42:41 +00:00
|
|
|
*/
|
|
|
|
native cvarhook:hook_cvar_change(pcvar, const callback[]);
|
|
|
|
|
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* Disables a cvar hook, stopping it from being called.
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param handle Forward to disable
|
|
|
|
* @error If an invalid hook handle is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 19:42:41 +00:00
|
|
|
*/
|
|
|
|
native disable_cvar_hook(cvarhook:handle);
|
|
|
|
|
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* Enables a cvar hook, restoring it to being called.
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Use the handle returned by hook_cvar_change as the parameter here.
|
2015-01-21 19:42:41 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param handle Forward to enable
|
|
|
|
* @error If an invalid hook handle is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-16 22:14:15 +00:00
|
|
|
*/
|
2015-01-21 19:42:41 +00:00
|
|
|
native enable_cvar_hook(cvarhook:handle);
|
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
2015-02-24 21:51:36 +00:00
|
|
|
* Returns flags of a cvar. The cvar is accessed by name.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent get_pcvar_flags() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param cvar Cvar name to retrieve flags from
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @return Flag value
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native get_cvar_flags(const cvar[]);
|
2015-01-21 19:42:41 +00:00
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
|
|
|
* Sets specified flags to a cvar. The cvar is accessed by name.
|
|
|
|
*
|
|
|
|
* @note Not permitted for the "amx_version", "amxmodx_version", "fun_version"
|
|
|
|
* and "sv_cheats" cvars.
|
|
|
|
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
|
|
* @note This function just adds the flags using a bitwise-or operation. After
|
|
|
|
* it has run the flags may not exactly equal the specified bitflag sum.
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent set_pcvar_flags() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to remove flags from
|
|
|
|
* @param flags Bitflag sum of flags to set
|
|
|
|
*
|
|
|
|
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
|
|
|
*/
|
|
|
|
native set_cvar_flags(const cvar[], flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes specified flags from a cvar. The cvar is accessed by name.
|
|
|
|
*
|
|
|
|
* @note Not permitted for the "amx_version", "amxmodx_version", "fun_version"
|
|
|
|
* and "sv_cheats" cvars.
|
|
|
|
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
|
|
* @note This function removes the flags using a bitwise-and operation.
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the set_pcvar_flags() function should be used instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to remove flags from
|
|
|
|
* @param flags Bitflag sum of flags to remove
|
|
|
|
*
|
|
|
|
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
|
|
|
*/
|
|
|
|
native remove_cvar_flags(const cvar[], flags=-1);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets a string value from a cvar. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent get_pcvar_string() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to retrieve value from
|
|
|
|
* @param output Buffer to copy cvar value to
|
|
|
|
* @param iLen Maximum size of the buffer
|
|
|
|
*
|
|
|
|
* @return Number of cells written to buffer.
|
|
|
|
*/
|
|
|
|
native get_cvar_string(const cvarname[], output[], iLen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a cvar to a given string value. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent set_pcvar_string() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to set value of
|
|
|
|
* @param value Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native set_cvar_string(const cvar[], const value[]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a floating value from a cvar. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent get_pcvar_float() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvarname Cvar name to retrieve value from
|
|
|
|
*
|
|
|
|
* @return Cvar value, converted to float
|
|
|
|
*/
|
|
|
|
native Float:get_cvar_float(const cvarname[]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a cvar to a given float value. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent set_pcvar_float() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to set value of
|
|
|
|
* @param value Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native set_cvar_float(const cvar[], Float:value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an integer value from a cvar. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent get_pcvar_num() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvarname Cvar name to retrieve value from
|
|
|
|
*
|
|
|
|
* @return Cvar value, converted to int
|
|
|
|
*/
|
|
|
|
native get_cvar_num(const cvarname[]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a cvar to a given integer value. The cvar is accessed by name.
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note Accessing a Cvar by name is slower than direct pointer access, which is
|
|
|
|
* why the otherwise equivalent set_pcvar_num() function should be used
|
|
|
|
* instead.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param cvar Cvar name to set value of
|
|
|
|
* @param value Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
*/
|
|
|
|
native set_cvar_num(const cvarname[], value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns flags of a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve flags from
|
|
|
|
*
|
|
|
|
* @return 1 on success, 0 if cvar pointer is invalid
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native get_pcvar_flags(pcvar);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets specified flags to a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @note For a list of possible flags see the FCVAR_* constants in amxconst.inc
|
|
|
|
* @note This function directly sets the provided bitflag, unlike set_cvar_flags
|
|
|
|
* which adds them using a bitwise OR.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to set flags of
|
|
|
|
* @param flags Bitflag sum of flags to set
|
|
|
|
*
|
|
|
|
* @return 1 on success, 0 if cvar does not exist or is not permitted
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_flags(pcvar, flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an integer value from a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve value from
|
|
|
|
*
|
|
|
|
* @return Cvar value, converted to int
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native get_pcvar_num(pcvar);
|
|
|
|
|
2015-01-25 19:15:35 +00:00
|
|
|
/**
|
|
|
|
* Returns an boolean value from a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve value from
|
|
|
|
*
|
|
|
|
* @return Cvar value, converted to bool
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-25 19:15:35 +00:00
|
|
|
*/
|
|
|
|
native bool:get_pcvar_bool(pcvar);
|
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
|
|
|
* Sets an integer value to a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to set value of
|
|
|
|
* @param num Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_num(pcvar, num);
|
|
|
|
|
2015-01-25 19:15:35 +00:00
|
|
|
/**
|
|
|
|
* Sets a boolean value to a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to set value of
|
|
|
|
* @param num Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-25 19:15:35 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_bool(pcvar, bool:num);
|
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
|
|
|
* Returns a float value from a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve value from
|
|
|
|
*
|
|
|
|
* @return Cvar value, converted to float
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native Float:get_pcvar_float(pcvar);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a float value to a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to set value of
|
|
|
|
* @param num Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_float(pcvar, Float:num);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string value from a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve value from
|
|
|
|
* @param string Buffer to copy cvar value to
|
|
|
|
* @param maxlen Maximum size of the buffer
|
|
|
|
*
|
|
|
|
* @return Number of cells written to buffer.
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native get_pcvar_string(pcvar, string[], maxlen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a string value to a cvar via direct pointer access.
|
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar to retrieve value from
|
|
|
|
* @param string Value to set cvar to
|
|
|
|
*
|
|
|
|
* @noreturn
|
2015-02-20 14:35:06 +00:00
|
|
|
* @error If an invalid cvar pointer is provided, an error will be
|
|
|
|
* thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_string(pcvar, const string[]);
|
|
|
|
|
2015-01-23 15:45:28 +00:00
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* Retrieves the specified value boundary of a cvar.
|
2015-01-23 15:45:28 +00:00
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param type Type of boundary to retrieve
|
|
|
|
* @param value Variable to store the specified boundary to
|
2015-01-23 15:45:28 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @return True if the cvar has a boundary set, false otherwise
|
|
|
|
* @error If an invalid cvar pointer or boundary type is provided,
|
|
|
|
* an error will be thrown.
|
2015-01-23 15:45:28 +00:00
|
|
|
*/
|
|
|
|
native bool:get_pcvar_bounds(pcvar, CvarBounds:type, &Float:value);
|
|
|
|
|
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* Sets the specified boundary of a cvar.
|
2015-01-23 15:45:28 +00:00
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param type Type of boundary to set
|
|
|
|
* @param set If true the cvar boundary will be set, otherwise it will be
|
|
|
|
* removed (value is ignored)
|
|
|
|
* @param value Floating point value to use as the boundary
|
2015-01-23 15:45:28 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @noreturn
|
|
|
|
* @error If an invalid cvar pointer or boundary type is provided, an
|
|
|
|
* error will be thrown.
|
2015-01-23 15:45:28 +00:00
|
|
|
*/
|
|
|
|
native set_pcvar_bounds(pcvar, CvarBounds:type, bool:set, Float:value = 0.0);
|
|
|
|
|
2015-01-24 20:28:43 +00:00
|
|
|
/**
|
2015-01-29 20:44:53 +00:00
|
|
|
* Binds a cvar's integer value to a global variable. The variable will then
|
|
|
|
* always contain the current cvar value as it is automatically kept up to date.
|
|
|
|
*
|
|
|
|
* @note The variable *has* to be a global or a static variable. Local variables
|
|
|
|
* created within functions can not be used for technical reasons.
|
|
|
|
* @note Variables can not be bound to multiple cvars.
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar
|
2015-01-29 20:44:53 +00:00
|
|
|
* @param var Global variable to keep updated
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @noreturn
|
|
|
|
* @error If an invalid cvar pointer or variable is provided, an error
|
|
|
|
* will be thrown.
|
2015-01-24 20:28:43 +00:00
|
|
|
*/
|
|
|
|
native bind_pcvar_num(pcvar, &any:var);
|
|
|
|
|
|
|
|
/**
|
2015-01-29 20:44:53 +00:00
|
|
|
* Binds a cvar's float value to a global variable. The variable will then
|
|
|
|
* always contain the current cvar value as it is automatically kept up to date.
|
|
|
|
*
|
|
|
|
* @note The variable *has* to be a global or a static variable. Local variables
|
|
|
|
* created within functions can not be used for technical reasons.
|
|
|
|
* @note Variables can not be bound to multiple cvars.
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar
|
2015-01-29 20:44:53 +00:00
|
|
|
* @param var Global variable to keep updated
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @noreturn
|
|
|
|
* @error If an invalid cvar pointer or variable is provided, an error
|
|
|
|
* will be thrown.
|
2015-01-24 20:28:43 +00:00
|
|
|
*/
|
|
|
|
native bind_pcvar_float(pcvar, &Float:var);
|
|
|
|
|
|
|
|
/**
|
2015-01-29 20:44:53 +00:00
|
|
|
* Binds a cvar's string value to a global array. The array will then
|
|
|
|
* always contain the current cvar value as it is automatically kept up to date.
|
|
|
|
*
|
|
|
|
* @note The array *has* to be a global or a static array. Local arrays
|
|
|
|
* created within functions can not be used for technical reasons.
|
|
|
|
* @note Arrays can not be bound to multiple cvars.
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
|
|
|
* @param pcvar Pointer to cvar
|
2015-01-29 20:44:53 +00:00
|
|
|
* @param var Global array to keep updated
|
|
|
|
* @param varlen Maximum length of string array
|
2015-01-24 20:28:43 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @noreturn
|
|
|
|
* @error If an invalid cvar pointer or variable is provided, an error
|
|
|
|
* will be thrown.
|
2015-01-24 20:28:43 +00:00
|
|
|
*/
|
|
|
|
native bind_pcvar_string(pcvar, any:var[], varlen);
|
|
|
|
|
2015-01-21 22:58:01 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of plugin-registered cvars.
|
|
|
|
*
|
|
|
|
* @return Number of registered cvars
|
|
|
|
*/
|
|
|
|
native get_plugins_cvarsnum();
|
|
|
|
|
|
|
|
/**
|
2015-02-20 14:35:06 +00:00
|
|
|
* Retrieves information about a plugin-registered cvar via iterative access.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @note The returned cvar pointer should be used with the get_pcvar_* and
|
|
|
|
* set_pcvar_* set of functions.
|
2015-02-20 14:35:06 +00:00
|
|
|
* @note The cvar index does not equal the cvar pointer. It is the internal
|
|
|
|
* AMXX id of a cvar, incremented for each registered cvar.
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* @param num Index to retrieve
|
2015-01-21 22:58:01 +00:00
|
|
|
* @param name Buffer to copy cvar name to
|
|
|
|
* @param namelen Maximum buffer size
|
|
|
|
* @param flags Variable to store cvar flags to
|
|
|
|
* @param plugin_id Variable to store id of the registering plugin to
|
|
|
|
* @param pcvar_handle Variable to store cvar pointer to
|
2015-01-25 10:38:01 +00:00
|
|
|
* @param description Variable to store cvar description to
|
|
|
|
* @param desc_len Maximum length of string buffer
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @return 1 on success, 0 if index is invalid
|
|
|
|
*/
|
2015-02-20 14:35:06 +00:00
|
|
|
native get_plugins_cvar(num, name[], namelen, &flags = 0, &plugin_id = 0, &pcvar_handle = 0, description[] = "", desc_len = 0);
|
2015-01-21 22:58:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dispatches a client cvar query, allowing the plugin to query for its value on
|
|
|
|
* the client.
|
|
|
|
*
|
|
|
|
* @note The callback will be called in the following manner:
|
|
|
|
*
|
|
|
|
* public cvar_query_callback(id, const cvar[], const value[], const param[])
|
|
|
|
*
|
2015-02-20 14:35:06 +00:00
|
|
|
* id - Client index
|
|
|
|
* cvar - Cvar queried
|
|
|
|
* value - Cvar value on the client
|
|
|
|
* param - Optional extra data
|
2015-01-21 22:58:01 +00:00
|
|
|
*
|
|
|
|
* @param id Client index
|
|
|
|
* @param cvar Cvar to query
|
|
|
|
* @param resultFunc Callback function
|
|
|
|
* @param paramlen Size of extra data
|
|
|
|
* @param params Extra data to pass through to callback
|
|
|
|
*
|
|
|
|
* @noreturn
|
|
|
|
* @error If the client index is not within the range of 1 to
|
2015-02-20 14:35:06 +00:00
|
|
|
* MaxClients, the client is not connected, the callback
|
|
|
|
* function is invalid or the querying process encounters
|
|
|
|
* a problem, an error will be thrown.
|
2015-01-21 22:58:01 +00:00
|
|
|
*/
|
2015-02-20 14:35:06 +00:00
|
|
|
native query_client_cvar(id, const cvar[], const resultFunc[], paramlen = 0, const params[] = "");
|