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