plugins/include/console.inc
author Scott Ehlert <ds@alliedmods.net>
Thu Jun 07 02:04:05 2007 +0000 (2007-06-07)
changeset 898 f8ff0a7cd037
parent 893 a3bc816549a8
child 899 af4da125603b
permissions -rw-r--r--
Yikes, fixed PrintToChatAll() and PrintCenterTextAll()
ds@457
     1
/**
ds@475
     2
 * vim: set ts=4 :
ds@457
     3
 * ===============================================================
ds@457
     4
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
ds@457
     5
 * ===============================================================
ds@457
     6
 *
ds@457
     7
 *  This file is part of the SourceMod/SourcePawn SDK.  This file may only be used 
ds@457
     8
 * or modified under the Terms and Conditions of its License Agreement, which is found 
ds@457
     9
 * in LICENSE.txt.  The Terms and Conditions for making SourceMod extensions/plugins 
ds@457
    10
 * may change at any time.  To view the latest information, see:
ds@457
    11
 *   http://www.sourcemod.net/license.php
ds@457
    12
 *
ds@457
    13
 * Version: $Id$
ds@457
    14
 */
ds@457
    15
 
ds@457
    16
#if defined _console_included
ds@457
    17
 #endinput
ds@457
    18
#endif
ds@457
    19
#define _console_included
ds@457
    20
ds@457
    21
/**
ds@714
    22
 * Console variable bound values used with Get/SetConVarBounds()
ds@714
    23
 */
ds@714
    24
enum ConVarBounds
ds@714
    25
{
ds@714
    26
	ConVarBound_Upper = 0,
ds@714
    27
	ConVarBound_Lower
ds@714
    28
};
ds@714
    29
ds@714
    30
/**
ds@697
    31
 * Console variable query helper values.
ds@697
    32
 */
ds@697
    33
enum QueryCookie
ds@697
    34
{
ds@697
    35
	QUERYCOOKIE_FAILED = 0,
dvander@815
    36
};
ds@697
    37
ds@697
    38
/**
ds@696
    39
 * Console variable query result values.
ds@696
    40
 */
ds@696
    41
enum ConVarQueryResult
ds@696
    42
{
ds@696
    43
	ConVarQuery_Okay = 0,				/**< Retrieval of client convar value was successful. */
ds@696
    44
	ConVarQuery_NotFound,				/**< Client convar was not found. */
ds@696
    45
	ConVarQuery_NotValid,				/**< A console command with the same name was found, but there is no convar. */
ds@696
    46
	ConVarQuery_Protected				/**< Client convar was found, but it is protected. The server cannot retrieve its value. */
ds@696
    47
};
ds@696
    48
ds@696
    49
/**
dvander@619
    50
 * @section Flags for console commands and console variables.  The descriptions 
dvander@619
    51
 * for each constant come directly from the Source SDK.
ds@457
    52
 */
ds@475
    53
#define FCVAR_NONE				0		/**< The default, no flags at all */
ds@475
    54
#define FCVAR_UNREGISTERED		(1<<0)	/**< If this is set, don't add to linked list, etc. */
ds@475
    55
#define FCVAR_LAUNCHER			(1<<1)	/**< Defined by launcher. */
ds@475
    56
#define FCVAR_GAMEDLL			(1<<2)	/**< Defined by the game DLL. */
ds@475
    57
#define FCVAR_CLIENTDLL			(1<<3)	/**< Defined by the client DLL. */
ds@475
    58
#define FCVAR_MATERIAL_SYSTEM	(1<<4)	/**< Defined by the material system. */
ds@475
    59
#define FCVAR_PROTECTED			(1<<5)	/**< It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value. */
ds@475
    60
#define FCVAR_SPONLY			(1<<6)	/**< This cvar cannot be changed by clients connected to a multiplayer server. */
ds@475
    61
#define	FCVAR_ARCHIVE			(1<<7)	/**< Set to cause it to be saved to vars.rc */
ds@475
    62
#define	FCVAR_NOTIFY			(1<<8)	/**< Notifies players when changed. */
ds@475
    63
#define	FCVAR_USERINFO			(1<<9)	/**< Changes the client's info string. */
ds@475
    64
#define FCVAR_PRINTABLEONLY		(1<<10)	/**< This cvar's string cannot contain unprintable characters (e.g., used for player name, etc.) */
ds@475
    65
#define FCVAR_UNLOGGED			(1<<11)	/**< If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log */
ds@475
    66
#define FCVAR_NEVER_AS_STRING	(1<<12)	/**< Never try to print that cvar. */
ds@475
    67
#define FCVAR_REPLICATED		(1<<13)	/**< Server setting enforced on clients. */
ds@475
    68
#define FCVAR_CHEAT				(1<<14)	/**< Only useable in singleplayer / debug / multiplayer & sv_cheats */
ds@475
    69
#define FCVAR_STUDIORENDER		(1<<15)	/**< Defined by the studiorender system. */
ds@475
    70
#define FCVAR_DEMO				(1<<16)	/**< Record this cvar when starting a demo file. */
ds@475
    71
#define FCVAR_DONTRECORD		(1<<17)	/**< Don't record these command in demo files. */
ds@475
    72
#define FCVAR_PLUGIN			(1<<18)	/**< Defined by a 3rd party plugin. */
ds@475
    73
#define FCVAR_DATACACHE			(1<<19)	/**< Defined by the datacache system. */
ds@475
    74
#define FCVAR_TOOLSYSTEM		(1<<20)	/**< Defined by an IToolSystem library */
ds@475
    75
#define FCVAR_FILESYSTEM		(1<<21)	/**< Defined by the file system. */
ds@475
    76
#define FCVAR_NOT_CONNECTED		(1<<22)	/**< Cvar cannot be changed by a client that is connected to a server. */
ds@475
    77
#define FCVAR_SOUNDSYSTEM		(1<<23)	/**< Defined by the soundsystem library. */
ds@475
    78
#define FCVAR_ARCHIVE_XBOX		(1<<24)	/**< Cvar written to config.cfg on the Xbox. */
ds@475
    79
#define FCVAR_INPUTSYSTEM		(1<<25)	/**< Defined by the inputsystem DLL. */
ds@475
    80
#define FCVAR_NETWORKSYSTEM		(1<<26)	/**< Defined by the network system. */
ds@476
    81
#define FCVAR_VPHYSICS			(1<<27)	/**< Defined by vphysics. */
ds@457
    82
dvander@522
    83
/**
dvander@619
    84
 * @endsection
dvander@619
    85
 */
dvander@619
    86
dvander@619
    87
/**
dvander@522
    88
 * Executes a server command as if it were on the server console (or RCON)
dvander@522
    89
 *
dvander@522
    90
 * @param format		Formatting rules.
dvander@522
    91
 * @param ...			Variable number of format parameters.
dvander@522
    92
 * @noreturn
dvander@522
    93
 */
ds@634
    94
native ServerCommand(const String:format[], any:...);
dvander@522
    95
dvander@522
    96
/**
dvander@522
    97
 * Inserts a server command at the beginning of the server command buffer.
dvander@522
    98
 *
dvander@522
    99
 * @param format		Formatting rules.
dvander@522
   100
 * @param ...			Variable number of format parameters.
dvander@522
   101
 * @noreturn
dvander@522
   102
 */
ds@634
   103
native InsertServerCommand(const String:format[], any:...);
dvander@522
   104
dvander@522
   105
/**
dvander@522
   106
 * Executes every command in the server's command buffer, rather than once per frame.
dvander@522
   107
 *
dvander@522
   108
 * @noreturn
dvander@522
   109
 */
dvander@522
   110
native ServerExecute();
dvander@480
   111
dvander@480
   112
/**
dvander@532
   113
 * Executes a client command.  Note that this will not work on clients unless
dvander@532
   114
 * they have cl_restrict_server_commands set to 0.
dvander@532
   115
 *
dvander@532
   116
 * @param client		Index of the client.
dvander@532
   117
 * @param fmt			Format of the client command.
dvander@532
   118
 * @param ...			Format parameters/
dvander@532
   119
 * @noreturn
dvander@532
   120
 * @error				Invalid client index, or client not connected.
dvander@532
   121
 */
ds@634
   122
native ClientCommand(client, const String:fmt[], any:...);
dvander@532
   123
dvander@532
   124
/**
dvander@480
   125
 * Sends a message to the server console.
dvander@480
   126
 *
dvander@480
   127
 * @param format		Formatting rules.
dvander@480
   128
 * @param ...			Variable number of format parameters.
dvander@480
   129
 * @noreturn
dvander@480
   130
 */
ds@634
   131
native PrintToServer(const String:format[], any:...);
dvander@480
   132
dvander@480
   133
/**
dvander@480
   134
 * Sends a message to a client's console.
dvander@480
   135
 *
dvander@893
   136
 * @param client		Client index.
dvander@480
   137
 * @param format		Formatting rules.
dvander@480
   138
 * @param ...			Variable number of format parameters.
dvander@480
   139
 * @noreturn
ds@873
   140
 * @error				If the client is not connected an error will be thrown.
dvander@480
   141
 */
ds@634
   142
native PrintToConsole(client, const String:format[], any:...);
dvander@480
   143
ds@457
   144
/**
dvander@893
   145
 * Reples to a message in a command.
dvander@893
   146
 *
dvander@893
   147
 * A client index of 0 will use PrintToServer().
dvander@893
   148
 * If the command was from the console, PrintToConsole() is used.
dvander@893
   149
 * If the command was from chat, PrintToChat() is used.
dvander@893
   150
 *
dvander@893
   151
 * @param client		Client index, or 0 for server.
dvander@893
   152
 * @param format		Formatting rules.
dvander@893
   153
 * @param ...			Variable number of format parameters.
dvander@893
   154
 * @noreturn
dvander@893
   155
 * @error				If the client is not connected or invalid.
dvander@893
   156
 */
dvander@893
   157
native ReplyToCommand(client, const String:fornmat[], any:...);
dvander@893
   158
dvander@893
   159
/**
dvander@498
   160
 * Called when a server-only command is invoked.  
dvander@498
   161
 *
dvander@520
   162
 * @params args			Number of arguments that were in the argument string.
dvander@708
   163
 * @return				An Action value.  Not handling the command
dvander@498
   164
 *						means that Source will report it as "not found."
dvander@498
   165
 */
dvander@520
   166
functag SrvCmd Action:public(args);
dvander@498
   167
dvander@498
   168
/**
dvander@498
   169
 * Creates a server-only console command, or hooks an already existing one.  
dvander@498
   170
 *
dvander@498
   171
 * @param cmd			Name of the command to hook or create.
dvander@498
   172
 * @param callback		A function to use as a callback for when the command is invoked.
dvander@498
   173
 * @param description	Optional description to use for command creation.
dvander@498
   174
 * @param flags			Optional flags to use for command creation.
dvander@498
   175
 * @noreturn
ds@579
   176
 * @error				Command name is the same as an existing convar.
dvander@498
   177
 */
dvander@498
   178
native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:description[]="", flags=0);
dvander@498
   179
dvander@498
   180
/**
dvander@498
   181
 * Called when a generic console command is invoked.
dvander@498
   182
 *
dvander@498
   183
 * @param client		Index of the client, or 0 from the server.
dvander@520
   184
 * @param args			Number of arguments that were in the argument string.
dvander@708
   185
 * @return				An Action value.  Not handling the command
dvander@498
   186
 *						means that Source will report it as "not found."
dvander@498
   187
 */
dvander@520
   188
functag ConCmd Action:public(client, args);
dvander@498
   189
dvander@498
   190
/**
dvander@498
   191
 * Creates a console command, or hooks an already existing one.
dvander@498
   192
 *
dvander@498
   193
 * @param cmd			Name of the command to hook or create.
dvander@498
   194
 * @param callback		A function to use as a callback for when the command is invoked.
dvander@498
   195
 * @param description	Optional description to use for command creation.
dvander@498
   196
 * @param flags			Optional flags to use for command creation.
dvander@498
   197
 * @noreturn
ds@579
   198
 * @error				Command name is the same as an existing convar.
dvander@498
   199
 */
dvander@498
   200
native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:description[]="", flags=0);
dvander@498
   201
dvander@498
   202
/**
dvander@498
   203
 * Creates a console command as an administrative command.  If the command does not exist,
dvander@520
   204
 * it is created.  When this command is invoked, the access rights of the player are 
dvander@520
   205
 * automatically checked before allowing it to continue.
dvander@498
   206
 *
dvander@498
   207
 * @param cmd			String containing command to register.
dvander@498
   208
 * @param callback		A function to use as a callback for when the command is invoked.
dvander@498
   209
 * @param adminflags	Administrative flags (bitstring) to use for permissions.
dvander@498
   210
 * @param group			String containing the command group to use.  If empty,
dvander@498
   211
 * 						the plugin's filename will be used instead.
dvander@498
   212
 * @param description	Optional description to use for help.
dvander@498
   213
 * @param flags			Optional console flags.
dvander@498
   214
 * @noreturn
ds@579
   215
 * @error				Command name is the same as an existing convar.
dvander@498
   216
 */
dvander@514
   217
native RegAdminCmd(const String:cmd[],
dvander@514
   218
					ConCmd:callback,
dvander@514
   219
					adminflags,
dvander@514
   220
					const String:description[]="",
dvander@514
   221
					const String:group[]="",
dvander@514
   222
					flags=0);
dvander@517
   223
					
dvander@517
   224
/**
dvander@517
   225
 * Returns the number of arguments from the current console or server command.
dvander@517
   226
 * @note Unlike the HL2 engine call, this does not include the command itself.
dvander@517
   227
 *
dvander@517
   228
 * @return				Number of arguments to the current command.
dvander@517
   229
 */
dvander@517
   230
native GetCmdArgs();
dvander@517
   231
dvander@517
   232
/**
dvander@517
   233
 * Retrieves a command argument given its index, from the current console or 
dvander@517
   234
 * server command.
dvander@517
   235
 * @note Argument indexes start at 1; 0 retrieves the command name.
dvander@517
   236
 *
dvander@517
   237
 * @param argnum		Argument number to retrieve.
dvander@517
   238
 * @param buffer		Buffer to use for storing the string.
dvander@517
   239
 * @param maxlength		Maximum length of the buffer.
dvander@517
   240
 * @noreturn
dvander@517
   241
 */
dvander@517
   242
native GetCmdArg(argnum, String:buffer[], maxlength);
dvander@517
   243
dvander@517
   244
/**
dvander@517
   245
 * Retrieves the entire command argument string in one lump from the current 
dvander@517
   246
 * console or server command.
dvander@517
   247
 *
dvander@517
   248
 * @param buffer		Buffer to use for storing the string.
dvander@517
   249
 * @param maxlength		Maximum length of the buffer.
dvander@517
   250
 * @noreturn
dvander@517
   251
 */
dvander@517
   252
native GetCmdArgString(String:buffer[], maxlength);
dvander@498
   253
dvander@498
   254
/**
ds@457
   255
 * Creates a new console variable.
ds@457
   256
 *
ds@475
   257
 * @param name			Name of new convar.
ds@475
   258
 * @param defaultValue	String containing the default value of new convar.
ds@582
   259
 * @param description	Optional description of the convar.
ds@576
   260
 * @param flags			Optional bitstring of flags determining how the convar should be handled. See FCVAR_* constants for more details.
ds@475
   261
 * @param hasMin		Optional boolean that determines if the convar has a minimum value.
ds@475
   262
 * @param min			Minimum floating point value that the convar can have if hasMin is true.
ds@475
   263
 * @param hasMax		Optional boolean that determines if the convar has a maximum value.
ds@475
   264
 * @param max			Maximum floating point value that the convar can have if hasMax is true.
ds@457
   265
 * @return				A handle to the newly created convar. If the convar already exists, INVALID_HANDLE is returned.
ds@579
   266
 * @error				Convar name is blank or is the same as an existing console command.
ds@457
   267
 */
ds@582
   268
native Handle:CreateConVar(const String:name[], const String:defaultValue[], const String:description[]="", flags=0, bool:hasMin=false, Float:min=0.0, bool:hasMax=false, Float:max=0.0);
ds@457
   269
ds@457
   270
/**
ds@457
   271
 * Searches for a console variable.
ds@457
   272
 *
ds@475
   273
 * @param name			Name of convar to find.
ds@475
   274
 * @return				A handle to the convar if it is found. INVALID_HANDLE otherwise.
ds@457
   275
 */
ds@457
   276
native Handle:FindConVar(const String:name[]);
ds@457
   277
ds@457
   278
/**
ds@465
   279
 * Called when a console variable's value is changed.
ds@465
   280
 *
ds@475
   281
 * @param convar		Handle to the convar that was changed.
ds@475
   282
 * @param oldValue		String containing the value of the convar before it was changed.
ds@475
   283
 * @param newValue		String containing the new value of the convar.
ds@465
   284
 * @noreturn
ds@465
   285
 */
ds@582
   286
functag ConVarChanged public(Handle:convar, const String:oldValue[], const String:newValue[]);
ds@465
   287
ds@465
   288
/**
ds@465
   289
 * Creates a hook for when a console variable's value is changed.
ds@465
   290
 *
ds@475
   291
 * @param convar		Handle to the convar.
ds@475
   292
 * @param callback		An OnConVarChanged function pointer.
ds@465
   293
 * @noreturn
ds@475
   294
 * @error				Invalid or corrupt Handle or invalid callback function.
ds@465
   295
 */
ds@582
   296
native HookConVarChange(Handle:convar, ConVarChanged:callback);
ds@465
   297
ds@465
   298
/**
ds@465
   299
 * Removes a hook for when a console variable's value is changed.
ds@465
   300
 *
ds@475
   301
 * @param convar		Handle to the convar.
ds@475
   302
 * @param callback		An OnConVarChanged function pointer.
ds@472
   303
 * @noreturn
ds@475
   304
 * @error				Invalid or corrupt Handle, invalid callback function, or no active hook on convar.
ds@465
   305
 */
ds@582
   306
native UnhookConVarChange(Handle:convar, ConVarChanged:callback);
ds@465
   307
ds@465
   308
/**
ds@457
   309
 * Returns the boolean value of a console variable.
ds@457
   310
 *
ds@475
   311
 * @param convar		Handle to the convar.
ds@475
   312
 * @return				The boolean value of the convar.
ds@475
   313
 * @error				Invalid or corrupt Handle.
ds@457
   314
 */
ds@457
   315
native bool:GetConVarBool(Handle:convar);
ds@457
   316
ds@457
   317
/**
ds@457
   318
 * Sets the boolean value of a console variable.
ds@457
   319
 *
ds@475
   320
 * @param convar		Handle to the convar.
ds@475
   321
 * @param value			New boolean value.
ds@457
   322
 * @noreturn
ds@475
   323
 * @error				Invalid or corrupt Handle.
ds@457
   324
 */
ds@457
   325
native SetConVarBool(Handle:convar, bool:value);
ds@457
   326
ds@457
   327
/**
ds@457
   328
 * Returns the integer value of a console variable.
ds@457
   329
 *
ds@475
   330
 * @param convar		Handle to the convar.
ds@475
   331
 * @return				The integer value of the convar.
ds@475
   332
 * @error				Invalid or corrupt Handle.
ds@457
   333
 */
ds@457
   334
native GetConVarInt(Handle:convar);
ds@457
   335
ds@457
   336
/**
ds@457
   337
 * Sets the integer value of a console variable.
ds@457
   338
 *
ds@475
   339
 * @param convar		Handle to the convar.
ds@475
   340
 * @param value			New integer value.
ds@457
   341
 * @noreturn
ds@475
   342
 * @error				Invalid or corrupt Handle.
ds@457
   343
 */
ds@457
   344
native SetConVarInt(Handle:convar, value);
ds@457
   345
ds@457
   346
/**
ds@457
   347
 * Returns the floating point value of a console variable.
ds@457
   348
 *
ds@475
   349
 * @param convar		Handle to the convar.
ds@475
   350
 * @return				The floating point value of the convar.
ds@475
   351
 * @error				Invalid or corrupt Handle.
ds@457
   352
 */
ds@457
   353
native Float:GetConVarFloat(Handle:convar);
ds@457
   354
ds@457
   355
/**
ds@457
   356
 * Sets the floating point value of a console variable.
ds@457
   357
 *
ds@475
   358
 * @param convar		Handle to the convar.
ds@475
   359
 * @param value			New floating point value.
ds@457
   360
 * @noreturn
ds@475
   361
 * @error				Invalid or corrupt Handle.
ds@457
   362
 */
ds@457
   363
native SetConVarFloat(Handle:convar, Float:value);
ds@457
   364
ds@457
   365
/**
ds@457
   366
 * Retrieves the string value of a console variable.
ds@457
   367
 *
ds@475
   368
 * @param convar		Handle to the convar.
ds@475
   369
 * @param value			Buffer to store the value of the convar.
ds@475
   370
 * @param maxlength		Maximum length of string buffer.
ds@457
   371
 * @noreturn
ds@475
   372
 * @error				Invalid or corrupt Handle.     
ds@457
   373
 */
ds@465
   374
native GetConVarString(Handle:convar, String:value[], maxlength);
ds@457
   375
ds@457
   376
/**
ds@457
   377
 * Sets the string value of a console variable.
ds@457
   378
 *
ds@475
   379
 * @param convar		Handle to the convar.
ds@475
   380
 * @param value			New string value.
ds@457
   381
 * @noreturn
ds@475
   382
 * @error				Invalid or corrupt Handle.
ds@457
   383
 */
ds@457
   384
native SetConVarString(Handle:convar, const String:value[]);
ds@457
   385
ds@457
   386
/**
ds@457
   387
 * Returns the bitstring of flags on a console variable.
ds@457
   388
 *
ds@475
   389
 * @param convar		Handle to the convar.
ds@475
   390
 * @return				A bitstring containing the FCVAR_* flags that are enabled.
ds@475
   391
 * @error				Invalid or corrupt Handle.
ds@457
   392
 */
ds@457
   393
native GetConVarFlags(Handle:convar);
ds@457
   394
ds@457
   395
/**
ds@457
   396
 * Sets the bitstring of flags on a console variable.
ds@457
   397
 *
ds@475
   398
 * @param convar		Handle to the convar.
ds@475
   399
 * @param flags			A bitstring containing the FCVAR_* flags to enable.
ds@457
   400
 * @noreturn
ds@475
   401
 * @error				Invalid or corrupt Handle.
ds@457
   402
 */
ds@457
   403
native SetConVarFlags(Handle:convar, flags);
ds@457
   404
ds@457
   405
/**
ds@714
   406
 * Retrieves the specified bound of a console variable.
ds@714
   407
 *
ds@714
   408
 * @param convar		Handle to the convar.
ds@714
   409
 * @param type			Type of bound to retrieve, ConVarBound_Lower or ConVarBound_Upper.
ds@714
   410
 * @param value			By-reference cell to store the specified floating point bound value.
ds@714
   411
 * @return				True if the convar has the specified bound set, false otherwise.
ds@714
   412
 * @error				Invalid or corrupt Handle.
ds@714
   413
 */
ds@714
   414
native bool:GetConVarBounds(Handle:convar, ConVarBounds:type, &Float:value);
ds@714
   415
ds@714
   416
/**
ds@714
   417
 * Sets the specified bound of a console variable.
ds@714
   418
 *
ds@714
   419
 * @param convar		Handle to the convar.
ds@714
   420
 * @param type			Type of bound to set, ConVarBound_Lower or ConVarBound_Upper
ds@714
   421
 * @param set			If set to true, convar will use specified bound. If false, bound will be removed.
ds@714
   422
 * @param value			Floating point value to use as the specified bound.
ds@714
   423
 * @noreturn
ds@714
   424
 * @error				Invalid or corrupt Handle.
ds@714
   425
 */
ds@714
   426
native SetConVarBounds(Handle:convar, ConVarBounds:type, bool:set, Float:value=0.0);
ds@714
   427
ds@714
   428
/**
ds@465
   429
 * Retrieves the name of a console variable.
ds@465
   430
 *
ds@475
   431
 * @param convar		Handle to the convar.
ds@475
   432
 * @param value			Buffer to store the name of the convar.
ds@475
   433
 * @param maxlength		Maximum length of string buffer.
ds@465
   434
 * @noreturn
ds@475
   435
 * @error				Invalid or corrupt Handle.     
ds@465
   436
 */
ds@465
   437
native GetConVarName(Handle:convar, const String:name[], maxlength);
ds@465
   438
ds@465
   439
/**
ds@457
   440
 * Resets the console variable to its default value.
ds@457
   441
 *
ds@475
   442
 * @param convar		Handle to the convar.
ds@457
   443
 * @noreturn
ds@475
   444
 * @error				Invalid or corrupt Handle.
ds@457
   445
 */
ds@457
   446
native ResetConVar(Handle:convar);
ds@696
   447
ds@696
   448
funcenum ConVarQueryFinished
ds@696
   449
{	
ds@696
   450
	/**
ds@696
   451
	 * Called when a query to retrieve a client's console variable has finished.
ds@696
   452
	 *
ds@696
   453
	 * @param cookie		Unique identifier of query.
ds@696
   454
	 * @param client		Player index.
ds@696
   455
	 * @param result		Result of query that tells one whether or not query was successful.
ds@696
   456
	 *						See ConVarQueryResult enum for more details.
ds@696
   457
	 * @param convarName	Name of client convar that was queried.
ds@696
   458
	 * @param convarValue	Value of client convar that was queried if successful. This will be "" if it was not.
ds@696
   459
	 * @param value			Value that was passed when query was started.
ds@696
   460
	 * @noreturn
ds@696
   461
	 */
ds@696
   462
	public(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[], any:value),
ds@696
   463
	
ds@696
   464
	/**
ds@696
   465
	 * Called when a query to retrieve a client's console variable has finished.
ds@696
   466
	 *
ds@696
   467
	 * @param cookie		Unique identifier of query.
ds@696
   468
	 * @param client		Player index.
ds@696
   469
	 * @param result		Result of query that tells one whether or not query was successful.
ds@696
   470
	 *						See ConVarQueryResult enum for more details.
ds@696
   471
	 * @param convarName	Name of client convar that was queried.
ds@696
   472
	 * @param convarValue	Value of client convar that was queried if successful. This will be "" if it was not.
ds@696
   473
	 * @noreturn
ds@696
   474
	 */
ds@696
   475
	public(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
ds@696
   476
};
ds@696
   477
ds@696
   478
/**
ds@696
   479
 * Starts a query to retrieve the value of a client's console variable.
ds@696
   480
 *
ds@696
   481
 * @param client		Player index.
ds@696
   482
 * @param name			Name of client convar to query.
ds@696
   483
 * @param callback		A function to use as a callback when the query has finished.
ds@696
   484
 * @param value			Optional value to pass to the callback function.
ds@697
   485
 * @return				A cookie that uniquely identifies the query. 
ds@697
   486
 *						Returns QUERYCOOKIE_FAILED on failure, such as when used on a bot.
ds@696
   487
 */
ds@696
   488
native QueryCookie:QueryClientConVar(client, const String:cvarName[], ConVarQueryFinished:callback, any:value=0);