|
ds@1952
|
1 |
/** |
|
ds@1952
|
2 |
* vim: set ts=4 : |
|
ds@1952
|
3 |
* ============================================================================= |
|
ds@1952
|
4 |
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved. |
|
ds@1952
|
5 |
* ============================================================================= |
|
ds@1952
|
6 |
* |
|
ds@1952
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. |
|
ds@1952
|
8 |
* |
|
ds@1952
|
9 |
* This program is free software; you can redistribute it and/or modify it under |
|
ds@1952
|
10 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
ds@1952
|
11 |
* Free Software Foundation. |
|
ds@1952
|
12 |
* |
|
ds@1952
|
13 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
ds@1952
|
14 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
ds@1952
|
15 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
ds@1952
|
16 |
* details. |
|
ds@1952
|
17 |
* |
|
ds@1952
|
18 |
* You should have received a copy of the GNU General Public License along with |
|
ds@1952
|
19 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
ds@1952
|
20 |
* |
|
ds@1952
|
21 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
ds@1952
|
22 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
ds@1952
|
23 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
ds@1952
|
24 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
ds@1952
|
25 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
ds@1952
|
26 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
ds@1952
|
27 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
ds@1952
|
28 |
* or <http://www.sourcemod.net/license.php>. |
|
ds@1952
|
29 |
* |
|
ds@1952
|
30 |
* Version: $Id$ |
|
ds@1952
|
31 |
*/ |
|
ds@1952
|
32 |
|
|
ds@1952
|
33 |
#if defined _console_included |
|
ds@1952
|
34 |
#endinput |
|
ds@1952
|
35 |
#endif |
|
ds@1952
|
36 |
#define _console_included |
|
ds@1952
|
37 |
|
|
ds@1952
|
38 |
#define INVALID_FCVAR_FLAGS (-1) |
|
ds@1952
|
39 |
|
|
ds@1952
|
40 |
/** |
|
ds@1952
|
41 |
* Console variable bound values used with Get/SetConVarBounds() |
|
ds@1952
|
42 |
*/ |
|
ds@1952
|
43 |
enum ConVarBounds |
|
ds@1952
|
44 |
{ |
|
ds@1952
|
45 |
ConVarBound_Upper = 0, |
|
ds@1952
|
46 |
ConVarBound_Lower |
|
ds@1952
|
47 |
}; |
|
ds@1952
|
48 |
|
|
ds@1952
|
49 |
/** |
|
ds@1952
|
50 |
* Console variable query helper values. |
|
ds@1952
|
51 |
*/ |
|
ds@1952
|
52 |
enum QueryCookie |
|
ds@1952
|
53 |
{ |
|
ds@1952
|
54 |
QUERYCOOKIE_FAILED = 0, |
|
ds@1952
|
55 |
}; |
|
ds@1952
|
56 |
|
|
ds@1952
|
57 |
/** |
|
ds@1952
|
58 |
* Reply sources for commands. |
|
ds@1952
|
59 |
*/ |
|
ds@1952
|
60 |
enum ReplySource |
|
ds@1952
|
61 |
{ |
|
ds@1952
|
62 |
SM_REPLY_TO_CONSOLE = 0, |
|
ds@1952
|
63 |
SM_REPLY_TO_CHAT = 1, |
|
ds@1952
|
64 |
}; |
|
ds@1952
|
65 |
|
|
ds@1952
|
66 |
/** |
|
ds@1952
|
67 |
* Console variable query result values. |
|
ds@1952
|
68 |
*/ |
|
ds@1952
|
69 |
enum ConVarQueryResult |
|
ds@1952
|
70 |
{ |
|
ds@1952
|
71 |
ConVarQuery_Okay = 0, /**< Retrieval of client convar value was successful. */ |
|
ds@1952
|
72 |
ConVarQuery_NotFound, /**< Client convar was not found. */ |
|
ds@1952
|
73 |
ConVarQuery_NotValid, /**< A console command with the same name was found, but there is no convar. */ |
|
ds@1952
|
74 |
ConVarQuery_Protected /**< Client convar was found, but it is protected. The server cannot retrieve its value. */ |
|
ds@1952
|
75 |
}; |
|
ds@1952
|
76 |
|
|
ds@1952
|
77 |
/** |
|
ds@1952
|
78 |
* @section Flags for console commands and console variables. The descriptions |
|
ds@1952
|
79 |
* for each constant come directly from the Source SDK. |
|
ds@1952
|
80 |
*/ |
|
ds@1952
|
81 |
#define FCVAR_NONE 0 /**< The default, no flags at all */ |
|
ds@1952
|
82 |
#define FCVAR_UNREGISTERED (1<<0) /**< If this is set, don't add to linked list, etc. */ |
|
ds@1952
|
83 |
#define FCVAR_LAUNCHER (1<<1) /**< Defined by launcher. */ |
|
ds@1952
|
84 |
#define FCVAR_GAMEDLL (1<<2) /**< Defined by the game DLL. */ |
|
ds@1952
|
85 |
#define FCVAR_CLIENTDLL (1<<3) /**< Defined by the client DLL. */ |
|
ds@1952
|
86 |
#define FCVAR_MATERIAL_SYSTEM (1<<4) /**< Defined by the material system. */ |
|
ds@1952
|
87 |
#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@1952
|
88 |
#define FCVAR_SPONLY (1<<6) /**< This cvar cannot be changed by clients connected to a multiplayer server. */ |
|
ds@1952
|
89 |
#define FCVAR_ARCHIVE (1<<7) /**< Set to cause it to be saved to vars.rc */ |
|
ds@1952
|
90 |
#define FCVAR_NOTIFY (1<<8) /**< Notifies players when changed. */ |
|
ds@1952
|
91 |
#define FCVAR_USERINFO (1<<9) /**< Changes the client's info string. */ |
|
ds@1952
|
92 |
#define FCVAR_PRINTABLEONLY (1<<10) /**< This cvar's string cannot contain unprintable characters (e.g., used for player name, etc.) */ |
|
ds@1952
|
93 |
#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@1952
|
94 |
#define FCVAR_NEVER_AS_STRING (1<<12) /**< Never try to print that cvar. */ |
|
ds@1952
|
95 |
#define FCVAR_REPLICATED (1<<13) /**< Server setting enforced on clients. */ |
|
ds@1952
|
96 |
#define FCVAR_CHEAT (1<<14) /**< Only useable in singleplayer / debug / multiplayer & sv_cheats */ |
|
ds@1952
|
97 |
#define FCVAR_STUDIORENDER (1<<15) /**< Defined by the studiorender system. */ |
|
ds@1952
|
98 |
#define FCVAR_DEMO (1<<16) /**< Record this cvar when starting a demo file. */ |
|
ds@1952
|
99 |
#define FCVAR_DONTRECORD (1<<17) /**< Don't record these command in demo files. */ |
|
ds@1952
|
100 |
#define FCVAR_PLUGIN (1<<18) /**< Defined by a 3rd party plugin. */ |
|
ds@1952
|
101 |
#define FCVAR_DATACACHE (1<<19) /**< Defined by the datacache system. */ |
|
ds@1952
|
102 |
#define FCVAR_TOOLSYSTEM (1<<20) /**< Defined by an IToolSystem library */ |
|
ds@1952
|
103 |
#define FCVAR_FILESYSTEM (1<<21) /**< Defined by the file system. */ |
|
ds@1952
|
104 |
#define FCVAR_NOT_CONNECTED (1<<22) /**< Cvar cannot be changed by a client that is connected to a server. */ |
|
ds@1952
|
105 |
#define FCVAR_SOUNDSYSTEM (1<<23) /**< Defined by the soundsystem library. */ |
|
ds@1952
|
106 |
#define FCVAR_ARCHIVE_XBOX (1<<24) /**< Cvar written to config.cfg on the Xbox. */ |
|
ds@1952
|
107 |
#define FCVAR_INPUTSYSTEM (1<<25) /**< Defined by the inputsystem DLL. */ |
|
ds@1952
|
108 |
#define FCVAR_NETWORKSYSTEM (1<<26) /**< Defined by the network system. */ |
|
ds@1952
|
109 |
#define FCVAR_VPHYSICS (1<<27) /**< Defined by vphysics. */ |
|
ds@1952
|
110 |
|
|
ds@1952
|
111 |
/** |
|
ds@1952
|
112 |
* @endsection |
|
ds@1952
|
113 |
*/ |
|
ds@1952
|
114 |
|
|
ds@1952
|
115 |
/** |
|
ds@1952
|
116 |
* Executes a server command as if it were on the server console (or RCON) |
|
ds@1952
|
117 |
* |
|
ds@1952
|
118 |
* @param format Formatting rules. |
|
ds@1952
|
119 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
120 |
* @noreturn |
|
ds@1952
|
121 |
*/ |
|
ds@1952
|
122 |
native ServerCommand(const String:format[], any:...); |
|
ds@1952
|
123 |
|
|
ds@1952
|
124 |
/** |
|
ds@1952
|
125 |
* Inserts a server command at the beginning of the server command buffer. |
|
ds@1952
|
126 |
* |
|
ds@1952
|
127 |
* @param format Formatting rules. |
|
ds@1952
|
128 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
129 |
* @noreturn |
|
ds@1952
|
130 |
*/ |
|
ds@1952
|
131 |
native InsertServerCommand(const String:format[], any:...); |
|
ds@1952
|
132 |
|
|
ds@1952
|
133 |
/** |
|
ds@1952
|
134 |
* Executes every command in the server's command buffer, rather than once per frame. |
|
ds@1952
|
135 |
* |
|
ds@1952
|
136 |
* @noreturn |
|
ds@1952
|
137 |
*/ |
|
ds@1952
|
138 |
native ServerExecute(); |
|
ds@1952
|
139 |
|
|
ds@1952
|
140 |
/** |
|
ds@1952
|
141 |
* Executes a client command. Note that this will not work on clients unless |
|
ds@1952
|
142 |
* they have cl_restrict_server_commands set to 0. |
|
ds@1952
|
143 |
* |
|
ds@1952
|
144 |
* @param client Index of the client. |
|
ds@1952
|
145 |
* @param fmt Format of the client command. |
|
ds@1952
|
146 |
* @param ... Format parameters/ |
|
ds@1952
|
147 |
* @noreturn |
|
ds@1952
|
148 |
* @error Invalid client index, or client not connected. |
|
ds@1952
|
149 |
*/ |
|
ds@1952
|
150 |
native ClientCommand(client, const String:fmt[], any:...); |
|
ds@1952
|
151 |
|
|
ds@1952
|
152 |
/** |
|
ds@1952
|
153 |
* Executes a client command on the server without being networked. |
|
ds@1952
|
154 |
* |
|
ds@1952
|
155 |
* FakeClientCommand() overwrites the command tokenization buffer. This can |
|
ds@1952
|
156 |
* cause undesired effects because future calls to GetCmdArg* will return |
|
ds@1952
|
157 |
* data from the FakeClientCommand(), not the parent command. If you are in |
|
ds@1952
|
158 |
* a hook where this matters (for example, a "say" hook), you should use |
|
ds@1952
|
159 |
* FakeClientCommandEx() instead. |
|
ds@1952
|
160 |
* |
|
ds@1952
|
161 |
* @param client Index of the client. |
|
ds@1952
|
162 |
* @param fmt Format of the client command. |
|
ds@1952
|
163 |
* @param ... Format parameters |
|
ds@1952
|
164 |
* @noreturn |
|
ds@1952
|
165 |
* @error Invalid client index, or client not connected. |
|
ds@1952
|
166 |
*/ |
|
ds@1952
|
167 |
native FakeClientCommand(client, const String:fmt[], any:...); |
|
ds@1952
|
168 |
|
|
ds@1952
|
169 |
/** |
|
ds@1952
|
170 |
* Executes a client command on the server without being networked. The |
|
ds@1952
|
171 |
* execution of the client command is delayed by one frame to prevent any |
|
ds@1952
|
172 |
* re-entrancy issues that might surface with FakeClientCommand(). |
|
ds@1952
|
173 |
* |
|
ds@1952
|
174 |
* @param client Index of the client. |
|
ds@1952
|
175 |
* @param fmt Format of the client command. |
|
ds@1952
|
176 |
* @param ... Format parameters |
|
ds@1952
|
177 |
* @noreturn |
|
ds@1952
|
178 |
* @error Invalid client index, or client not connected. |
|
ds@1952
|
179 |
*/ |
|
ds@1952
|
180 |
native FakeClientCommandEx(client, const String:fmt[], any:...); |
|
ds@1952
|
181 |
|
|
ds@1952
|
182 |
/** |
|
ds@1952
|
183 |
* Sends a message to the server console. |
|
ds@1952
|
184 |
* |
|
ds@1952
|
185 |
* @param format Formatting rules. |
|
ds@1952
|
186 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
187 |
* @noreturn |
|
ds@1952
|
188 |
*/ |
|
ds@1952
|
189 |
native PrintToServer(const String:format[], any:...); |
|
ds@1952
|
190 |
|
|
ds@1952
|
191 |
/** |
|
ds@1952
|
192 |
* Sends a message to a client's console. |
|
ds@1952
|
193 |
* |
|
ds@1952
|
194 |
* @param client Client index. |
|
ds@1952
|
195 |
* @param format Formatting rules. |
|
ds@1952
|
196 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
197 |
* @noreturn |
|
ds@1952
|
198 |
* @error If the client is not connected an error will be thrown. |
|
ds@1952
|
199 |
*/ |
|
ds@1952
|
200 |
native PrintToConsole(client, const String:format[], any:...); |
|
ds@1952
|
201 |
|
|
ds@1952
|
202 |
/** |
|
ds@1952
|
203 |
* Reples to a message in a command. |
|
ds@1952
|
204 |
* |
|
ds@1952
|
205 |
* A client index of 0 will use PrintToServer(). |
|
ds@1952
|
206 |
* If the command was from the console, PrintToConsole() is used. |
|
ds@1952
|
207 |
* If the command was from chat, PrintToChat() is used. |
|
ds@1952
|
208 |
* |
|
ds@1952
|
209 |
* @param client Client index, or 0 for server. |
|
ds@1952
|
210 |
* @param format Formatting rules. |
|
ds@1952
|
211 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
212 |
* @noreturn |
|
ds@1952
|
213 |
* @error If the client is not connected or invalid. |
|
ds@1952
|
214 |
*/ |
|
ds@1952
|
215 |
native ReplyToCommand(client, const String:format[], any:...); |
|
ds@1952
|
216 |
|
|
ds@1952
|
217 |
/** |
|
ds@1952
|
218 |
* Returns the current reply source of a command. |
|
ds@1952
|
219 |
* |
|
ds@1952
|
220 |
* @return ReplySource value. |
|
ds@1952
|
221 |
*/ |
|
ds@1952
|
222 |
native ReplySource:GetCmdReplySource(); |
|
ds@1952
|
223 |
|
|
ds@1952
|
224 |
/** |
|
ds@1952
|
225 |
* Sets the current reply source of a command. |
|
ds@1952
|
226 |
* |
|
ds@1952
|
227 |
* Only use this if you know what you are doing. You should save the old value |
|
ds@1952
|
228 |
* and restore it once you are done. |
|
ds@1952
|
229 |
* |
|
ds@1952
|
230 |
* @param source New ReplySource value. |
|
ds@1952
|
231 |
* @return Old ReplySource value. |
|
ds@1952
|
232 |
*/ |
|
ds@1952
|
233 |
native ReplySource:SetCmdReplySource(ReplySource:source); |
|
ds@1952
|
234 |
|
|
ds@1952
|
235 |
/** |
|
ds@1952
|
236 |
* Returns whether the current say hook is a chat trigger. |
|
ds@1952
|
237 |
* |
|
ds@1952
|
238 |
* This function is only meaningful inside say or say_team hooks. |
|
ds@1952
|
239 |
* |
|
ds@1952
|
240 |
* @return True if a chat trigger, false otherwise. |
|
ds@1952
|
241 |
*/ |
|
ds@1952
|
242 |
native bool:IsChatTrigger(); |
|
ds@1952
|
243 |
|
|
ds@1952
|
244 |
/** |
|
ds@1952
|
245 |
* Displays usage of an admin command to users depending on the |
|
ds@1952
|
246 |
* setting of the sm_show_activity cvar. All users receive a message |
|
ds@1952
|
247 |
* in their chat text, except for the originating client, who receives |
|
ds@1952
|
248 |
* the message based on the current ReplySource. |
|
ds@1952
|
249 |
* |
|
ds@1952
|
250 |
* @param client Client index doing the action, or 0 for server. |
|
ds@1952
|
251 |
* @param tag Tag to prepend to the message. |
|
ds@1952
|
252 |
* @param format Formatting rules. |
|
ds@1952
|
253 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
254 |
* @noreturn |
|
ds@1952
|
255 |
* @error |
|
ds@1952
|
256 |
*/ |
|
ds@1952
|
257 |
native ShowActivity2(client, const String:tag[], const String:format[], any:...); |
|
ds@1952
|
258 |
|
|
ds@1952
|
259 |
/** |
|
ds@1952
|
260 |
* Displays usage of an admin command to users depending on the |
|
ds@1952
|
261 |
* setting of the sm_show_activity cvar. |
|
ds@1952
|
262 |
* |
|
ds@1952
|
263 |
* This version does not display a message to the originating client |
|
ds@1952
|
264 |
* if used from chat triggers or menus. If manual replies are used |
|
ds@1952
|
265 |
* for these cases, then this function will suffice. Otherwise, |
|
ds@1952
|
266 |
* ShowActivity2() is slightly more useful. |
|
ds@1952
|
267 |
* |
|
ds@1952
|
268 |
* @param client Client index doing the action, or 0 for server. |
|
ds@1952
|
269 |
* @param format Formatting rules. |
|
ds@1952
|
270 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
271 |
* @noreturn |
|
ds@1952
|
272 |
* @error |
|
ds@1952
|
273 |
*/ |
|
ds@1952
|
274 |
native ShowActivity(client, const String:format[], any:...); |
|
ds@1952
|
275 |
|
|
ds@1952
|
276 |
/** |
|
ds@1952
|
277 |
* Same as ShowActivity(), except the tag parameter is used instead of |
|
ds@1952
|
278 |
* "[SM] " (note that you must supply any spacing). |
|
ds@1952
|
279 |
* |
|
ds@1952
|
280 |
* @param client Client index doing the action, or 0 for server. |
|
ds@1952
|
281 |
* @param tag Tag to display with. |
|
ds@1952
|
282 |
* @param format Formatting rules. |
|
ds@1952
|
283 |
* @param ... Variable number of format parameters. |
|
ds@1952
|
284 |
* @noreturn |
|
ds@1952
|
285 |
* @error |
|
ds@1952
|
286 |
*/ |
|
ds@1952
|
287 |
native ShowActivityEx(client, const String:tag[], const String:format[], any:...); |
|
ds@1952
|
288 |
|
|
ds@1952
|
289 |
/** |
|
ds@1952
|
290 |
* Called when a server-only command is invoked. |
|
ds@1952
|
291 |
* |
|
ds@1952
|
292 |
* @params args Number of arguments that were in the argument string. |
|
ds@1952
|
293 |
* @return An Action value. Not handling the command |
|
ds@1952
|
294 |
* means that Source will report it as "not found." |
|
ds@1952
|
295 |
*/ |
|
ds@1952
|
296 |
functag SrvCmd Action:public(args); |
|
ds@1952
|
297 |
|
|
ds@1952
|
298 |
/** |
|
ds@1952
|
299 |
* Creates a server-only console command, or hooks an already existing one. |
|
ds@1952
|
300 |
* |
|
ds@1952
|
301 |
* @param cmd Name of the command to hook or create. |
|
ds@1952
|
302 |
* @param callback A function to use as a callback for when the command is invoked. |
|
ds@1952
|
303 |
* @param description Optional description to use for command creation. |
|
ds@1952
|
304 |
* @param flags Optional flags to use for command creation. |
|
ds@1952
|
305 |
* @noreturn |
|
ds@1952
|
306 |
* @error Command name is the same as an existing convar. |
|
ds@1952
|
307 |
*/ |
|
ds@1952
|
308 |
native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:description[]="", flags=0); |
|
ds@1952
|
309 |
|
|
ds@1952
|
310 |
/** |
|
ds@1952
|
311 |
* Called when a generic console command is invoked. |
|
ds@1952
|
312 |
* |
|
ds@1952
|
313 |
* @param client Index of the client, or 0 from the server. |
|
ds@1952
|
314 |
* @param args Number of arguments that were in the argument string. |
|
ds@1952
|
315 |
* @return An Action value. Not handling the command |
|
ds@1952
|
316 |
* means that Source will report it as "not found." |
|
ds@1952
|
317 |
*/ |
|
ds@1952
|
318 |
functag ConCmd Action:public(client, args); |
|
ds@1952
|
319 |
|
|
ds@1952
|
320 |
/** |
|
ds@1952
|
321 |
* Creates a console command, or hooks an already existing one. |
|
ds@1952
|
322 |
* |
|
ds@1952
|
323 |
* @param cmd Name of the command to hook or create. |
|
ds@1952
|
324 |
* @param callback A function to use as a callback for when the command is invoked. |
|
ds@1952
|
325 |
* @param description Optional description to use for command creation. |
|
ds@1952
|
326 |
* @param flags Optional flags to use for command creation. |
|
ds@1952
|
327 |
* @noreturn |
|
ds@1952
|
328 |
* @error Command name is the same as an existing convar. |
|
ds@1952
|
329 |
*/ |
|
ds@1952
|
330 |
native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:description[]="", flags=0); |
|
ds@1952
|
331 |
|
|
ds@1952
|
332 |
/** |
|
ds@1952
|
333 |
* Creates a console command as an administrative command. If the command does not exist, |
|
ds@1952
|
334 |
* it is created. When this command is invoked, the access rights of the player are |
|
ds@1952
|
335 |
* automatically checked before allowing it to continue. |
|
ds@1952
|
336 |
* |
|
ds@1952
|
337 |
* @param cmd String containing command to register. |
|
ds@1952
|
338 |
* @param callback A function to use as a callback for when the command is invoked. |
|
ds@1952
|
339 |
* @param adminflags Administrative flags (bitstring) to use for permissions. |
|
ds@1952
|
340 |
* @param group String containing the command group to use. If empty, |
|
ds@1952
|
341 |
* the plugin's filename will be used instead. |
|
ds@1952
|
342 |
* @param description Optional description to use for help. |
|
ds@1952
|
343 |
* @param flags Optional console flags. |
|
ds@1952
|
344 |
* @noreturn |
|
ds@1952
|
345 |
* @error Command name is the same as an existing convar. |
|
ds@1952
|
346 |
*/ |
|
ds@1952
|
347 |
native RegAdminCmd(const String:cmd[], |
|
ds@1952
|
348 |
ConCmd:callback, |
|
ds@1952
|
349 |
adminflags, |
|
ds@1952
|
350 |
const String:description[]="", |
|
ds@1952
|
351 |
const String:group[]="", |
|
ds@1952
|
352 |
flags=0); |
|
ds@1952
|
353 |
|
|
ds@1952
|
354 |
/** |
|
ds@1952
|
355 |
* Returns the number of arguments from the current console or server command. |
|
ds@1952
|
356 |
* @note Unlike the HL2 engine call, this does not include the command itself. |
|
ds@1952
|
357 |
* |
|
ds@1952
|
358 |
* @return Number of arguments to the current command. |
|
ds@1952
|
359 |
*/ |
|
ds@1952
|
360 |
native GetCmdArgs(); |
|
ds@1952
|
361 |
|
|
ds@1952
|
362 |
/** |
|
ds@1952
|
363 |
* Retrieves a command argument given its index, from the current console or |
|
ds@1952
|
364 |
* server command. |
|
ds@1952
|
365 |
* @note Argument indexes start at 1; 0 retrieves the command name. |
|
ds@1952
|
366 |
* |
|
ds@1952
|
367 |
* @param argnum Argument number to retrieve. |
|
ds@1952
|
368 |
* @param buffer Buffer to use for storing the string. |
|
ds@1952
|
369 |
* @param maxlength Maximum length of the buffer. |
|
ds@1952
|
370 |
* @return Length of string written to buffer. |
|
ds@1952
|
371 |
*/ |
|
ds@1952
|
372 |
native GetCmdArg(argnum, String:buffer[], maxlength); |
|
ds@1952
|
373 |
|
|
ds@1952
|
374 |
/** |
|
ds@1952
|
375 |
* Retrieves the entire command argument string in one lump from the current |
|
ds@1952
|
376 |
* console or server command. |
|
ds@1952
|
377 |
* |
|
ds@1952
|
378 |
* @param buffer Buffer to use for storing the string. |
|
ds@1952
|
379 |
* @param maxlength Maximum length of the buffer. |
|
ds@1952
|
380 |
* @return Length of string written to buffer. |
|
ds@1952
|
381 |
*/ |
|
ds@1952
|
382 |
native GetCmdArgString(String:buffer[], maxlength); |
|
ds@1952
|
383 |
|
|
ds@1952
|
384 |
/** |
|
ds@1952
|
385 |
* Creates a new console variable. |
|
ds@1952
|
386 |
* |
|
ds@1952
|
387 |
* @param name Name of new convar. |
|
ds@1952
|
388 |
* @param defaultValue String containing the default value of new convar. |
|
ds@1952
|
389 |
* @param description Optional description of the convar. |
|
ds@1952
|
390 |
* @param flags Optional bitstring of flags determining how the convar should be handled. See FCVAR_* constants for more details. |
|
ds@1952
|
391 |
* @param hasMin Optional boolean that determines if the convar has a minimum value. |
|
ds@1952
|
392 |
* @param min Minimum floating point value that the convar can have if hasMin is true. |
|
ds@1952
|
393 |
* @param hasMax Optional boolean that determines if the convar has a maximum value. |
|
ds@1952
|
394 |
* @param max Maximum floating point value that the convar can have if hasMax is true. |
|
ds@1961
|
395 |
* @return A handle to the newly created convar. If the convar already exists, a handle to it will still be returned. |
|
ds@1952
|
396 |
* @error Convar name is blank or is the same as an existing console command. |
|
ds@1952
|
397 |
*/ |
|
ds@1952
|
398 |
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@1952
|
399 |
|
|
ds@1952
|
400 |
/** |
|
ds@1952
|
401 |
* Searches for a console variable. |
|
ds@1952
|
402 |
* |
|
ds@1952
|
403 |
* @param name Name of convar to find. |
|
ds@1952
|
404 |
* @return A handle to the convar if it is found. INVALID_HANDLE otherwise. |
|
ds@1952
|
405 |
*/ |
|
ds@1952
|
406 |
native Handle:FindConVar(const String:name[]); |
|
ds@1952
|
407 |
|
|
ds@1952
|
408 |
/** |
|
ds@1952
|
409 |
* Called when a console variable's value is changed. |
|
ds@1952
|
410 |
* |
|
ds@1952
|
411 |
* @param convar Handle to the convar that was changed. |
|
ds@1952
|
412 |
* @param oldValue String containing the value of the convar before it was changed. |
|
ds@1952
|
413 |
* @param newValue String containing the new value of the convar. |
|
ds@1952
|
414 |
* @noreturn |
|
ds@1952
|
415 |
*/ |
|
ds@1952
|
416 |
functag ConVarChanged public(Handle:convar, const String:oldValue[], const String:newValue[]); |
|
ds@1952
|
417 |
|
|
ds@1952
|
418 |
/** |
|
ds@1952
|
419 |
* Creates a hook for when a console variable's value is changed. |
|
ds@1952
|
420 |
* |
|
ds@1952
|
421 |
* @param convar Handle to the convar. |
|
ds@1952
|
422 |
* @param callback An OnConVarChanged function pointer. |
|
ds@1952
|
423 |
* @noreturn |
|
ds@1952
|
424 |
* @error Invalid or corrupt Handle or invalid callback function. |
|
ds@1952
|
425 |
*/ |
|
ds@1952
|
426 |
native HookConVarChange(Handle:convar, ConVarChanged:callback); |
|
ds@1952
|
427 |
|
|
ds@1952
|
428 |
/** |
|
ds@1952
|
429 |
* Removes a hook for when a console variable's value is changed. |
|
ds@1952
|
430 |
* |
|
ds@1952
|
431 |
* @param convar Handle to the convar. |
|
ds@1952
|
432 |
* @param callback An OnConVarChanged function pointer. |
|
ds@1952
|
433 |
* @noreturn |
|
ds@1952
|
434 |
* @error Invalid or corrupt Handle, invalid callback function, or no active hook on convar. |
|
ds@1952
|
435 |
*/ |
|
ds@1952
|
436 |
native UnhookConVarChange(Handle:convar, ConVarChanged:callback); |
|
ds@1952
|
437 |
|
|
ds@1952
|
438 |
/** |
|
ds@1952
|
439 |
* Returns the boolean value of a console variable. |
|
ds@1952
|
440 |
* |
|
ds@1952
|
441 |
* @param convar Handle to the convar. |
|
ds@1952
|
442 |
* @return The boolean value of the convar. |
|
ds@1952
|
443 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
444 |
*/ |
|
ds@1952
|
445 |
native bool:GetConVarBool(Handle:convar); |
|
ds@1952
|
446 |
|
|
ds@1952
|
447 |
/** |
|
ds@1952
|
448 |
* Sets the boolean value of a console variable. |
|
ds@1952
|
449 |
* |
|
ds@1952
|
450 |
* @param convar Handle to the convar. |
|
ds@1952
|
451 |
* @param value New boolean value. |
|
ds@1952
|
452 |
* @param replicate If set to true, the new convar value will be set on all clients. |
|
ds@1952
|
453 |
* This will only work if the convar has the FCVAR_REPLICATED flag |
|
ds@1952
|
454 |
* and actually exists on clients. |
|
ds@1952
|
455 |
* @param notify If set to true, clients will be notified that the convar has changed. |
|
ds@1952
|
456 |
* This will only work if the convar has the FCVAR_NOTIFY flag. |
|
ds@1952
|
457 |
* @noreturn |
|
ds@1952
|
458 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
459 |
*/ |
|
ds@1952
|
460 |
native SetConVarBool(Handle:convar, bool:value, bool:replicate=false, bool:notify=false); |
|
ds@1952
|
461 |
|
|
ds@1952
|
462 |
/** |
|
ds@1952
|
463 |
* Returns the integer value of a console variable. |
|
ds@1952
|
464 |
* |
|
ds@1952
|
465 |
* @param convar Handle to the convar. |
|
ds@1952
|
466 |
* @return The integer value of the convar. |
|
ds@1952
|
467 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
468 |
*/ |
|
ds@1952
|
469 |
native GetConVarInt(Handle:convar); |
|
ds@1952
|
470 |
|
|
ds@1952
|
471 |
/** |
|
ds@1952
|
472 |
* Sets the integer value of a console variable. |
|
ds@1952
|
473 |
* |
|
ds@1952
|
474 |
* @param convar Handle to the convar. |
|
ds@1952
|
475 |
* @param value New integer value. |
|
ds@1952
|
476 |
* @param replicate If set to true, the new convar value will be set on all clients. |
|
ds@1952
|
477 |
* This will only work if the convar has the FCVAR_REPLICATED flag |
|
ds@1952
|
478 |
* and actually exists on clients. |
|
ds@1952
|
479 |
* @param notify If set to true, clients will be notified that the convar has changed. |
|
ds@1952
|
480 |
* This will only work if the convar has the FCVAR_NOTIFY flag. |
|
ds@1952
|
481 |
* @noreturn |
|
ds@1952
|
482 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
483 |
*/ |
|
ds@1952
|
484 |
native SetConVarInt(Handle:convar, value, bool:replicate=false, bool:notify=false); |
|
ds@1952
|
485 |
|
|
ds@1952
|
486 |
/** |
|
ds@1952
|
487 |
* Returns the floating point value of a console variable. |
|
ds@1952
|
488 |
* |
|
ds@1952
|
489 |
* @param convar Handle to the convar. |
|
ds@1952
|
490 |
* @return The floating point value of the convar. |
|
ds@1952
|
491 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
492 |
*/ |
|
ds@1952
|
493 |
native Float:GetConVarFloat(Handle:convar); |
|
ds@1952
|
494 |
|
|
ds@1952
|
495 |
/** |
|
ds@1952
|
496 |
* Sets the floating point value of a console variable. |
|
ds@1952
|
497 |
* |
|
ds@1952
|
498 |
* @param convar Handle to the convar. |
|
ds@1952
|
499 |
* @param value New floating point value. |
|
ds@1952
|
500 |
* @param replicate If set to true, the new convar value will be set on all clients. |
|
ds@1952
|
501 |
* This will only work if the convar has the FCVAR_REPLICATED flag |
|
ds@1952
|
502 |
* and actually exists on clients. |
|
ds@1952
|
503 |
* @param notify If set to true, clients will be notified that the convar has changed. |
|
ds@1952
|
504 |
* This will only work if the convar has the FCVAR_NOTIFY flag. |
|
ds@1952
|
505 |
* @noreturn |
|
ds@1952
|
506 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
507 |
*/ |
|
ds@1952
|
508 |
native SetConVarFloat(Handle:convar, Float:value, bool:replicate=false, bool:notify=false); |
|
ds@1952
|
509 |
|
|
ds@1952
|
510 |
/** |
|
ds@1952
|
511 |
* Retrieves the string value of a console variable. |
|
ds@1952
|
512 |
* |
|
ds@1952
|
513 |
* @param convar Handle to the convar. |
|
ds@1952
|
514 |
* @param value Buffer to store the value of the convar. |
|
ds@1952
|
515 |
* @param maxlength Maximum length of string buffer. |
|
ds@1952
|
516 |
* @noreturn |
|
ds@1952
|
517 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
518 |
*/ |
|
ds@1952
|
519 |
native GetConVarString(Handle:convar, String:value[], maxlength); |
|
ds@1952
|
520 |
|
|
ds@1952
|
521 |
/** |
|
ds@1952
|
522 |
* Sets the string value of a console variable. |
|
ds@1952
|
523 |
* |
|
ds@1952
|
524 |
* @param convar Handle to the convar. |
|
ds@1952
|
525 |
* @param value New string value. |
|
ds@1952
|
526 |
* @param replicate If set to true, the new convar value will be set on all clients. |
|
ds@1952
|
527 |
* This will only work if the convar has the FCVAR_REPLICATED flag |
|
ds@1952
|
528 |
* and actually exists on clients. |
|
ds@1952
|
529 |
* @param notify If set to true, clients will be notified that the convar has changed. |
|
ds@1952
|
530 |
* This will only work if the convar has the FCVAR_NOTIFY flag. |
|
ds@1952
|
531 |
* @noreturn |
|
ds@1952
|
532 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
533 |
*/ |
|
ds@1952
|
534 |
native SetConVarString(Handle:convar, const String:value[], bool:replicate=false, bool:notify=false); |
|
ds@1952
|
535 |
|
|
ds@1952
|
536 |
/** |
|
ds@1952
|
537 |
* Resets the console variable to its default value. |
|
ds@1952
|
538 |
* |
|
ds@1952
|
539 |
* @param convar Handle to the convar. |
|
ds@1952
|
540 |
* @param replicate If set to true, the new convar value will be set on all clients. |
|
ds@1952
|
541 |
* This will only work if the convar has the FCVAR_REPLICATED flag |
|
ds@1952
|
542 |
* and actually exists on clients. |
|
ds@1952
|
543 |
* @param notify If set to true, clients will be notified that the convar has changed. |
|
ds@1952
|
544 |
* This will only work if the convar has the FCVAR_NOTIFY flag. |
|
ds@1952
|
545 |
* @noreturn |
|
ds@1952
|
546 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
547 |
*/ |
|
ds@1952
|
548 |
native ResetConVar(Handle:convar, bool:replicate=false, bool:notify=false); |
|
ds@1952
|
549 |
|
|
ds@1952
|
550 |
/** |
|
ds@1952
|
551 |
* Returns the bitstring of flags on a console variable. |
|
ds@1952
|
552 |
* |
|
ds@1952
|
553 |
* @param convar Handle to the convar. |
|
ds@1952
|
554 |
* @return A bitstring containing the FCVAR_* flags that are enabled. |
|
ds@1952
|
555 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
556 |
*/ |
|
ds@1952
|
557 |
native GetConVarFlags(Handle:convar); |
|
ds@1952
|
558 |
|
|
ds@1952
|
559 |
/** |
|
ds@1952
|
560 |
* Sets the bitstring of flags on a console variable. |
|
ds@1952
|
561 |
* |
|
ds@1952
|
562 |
* @param convar Handle to the convar. |
|
ds@1952
|
563 |
* @param flags A bitstring containing the FCVAR_* flags to enable. |
|
ds@1952
|
564 |
* @noreturn |
|
ds@1952
|
565 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
566 |
*/ |
|
ds@1952
|
567 |
native SetConVarFlags(Handle:convar, flags); |
|
ds@1952
|
568 |
|
|
ds@1952
|
569 |
/** |
|
ds@1952
|
570 |
* Retrieves the specified bound of a console variable. |
|
ds@1952
|
571 |
* |
|
ds@1952
|
572 |
* @param convar Handle to the convar. |
|
ds@1952
|
573 |
* @param type Type of bound to retrieve, ConVarBound_Lower or ConVarBound_Upper. |
|
ds@1952
|
574 |
* @param value By-reference cell to store the specified floating point bound value. |
|
ds@1952
|
575 |
* @return True if the convar has the specified bound set, false otherwise. |
|
ds@1952
|
576 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
577 |
*/ |
|
ds@1952
|
578 |
native bool:GetConVarBounds(Handle:convar, ConVarBounds:type, &Float:value); |
|
ds@1952
|
579 |
|
|
ds@1952
|
580 |
/** |
|
ds@1952
|
581 |
* Sets the specified bound of a console variable. |
|
ds@1952
|
582 |
* |
|
ds@1952
|
583 |
* @param convar Handle to the convar. |
|
ds@1952
|
584 |
* @param type Type of bound to set, ConVarBound_Lower or ConVarBound_Upper |
|
ds@1952
|
585 |
* @param set If set to true, convar will use specified bound. If false, bound will be removed. |
|
ds@1952
|
586 |
* @param value Floating point value to use as the specified bound. |
|
ds@1952
|
587 |
* @noreturn |
|
ds@1952
|
588 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
589 |
*/ |
|
ds@1952
|
590 |
native SetConVarBounds(Handle:convar, ConVarBounds:type, bool:set, Float:value=0.0); |
|
ds@1952
|
591 |
|
|
ds@1952
|
592 |
/** |
|
ds@1952
|
593 |
* Retrieves the name of a console variable. |
|
ds@1952
|
594 |
* |
|
ds@1952
|
595 |
* @param convar Handle to the convar. |
|
ds@1952
|
596 |
* @param value Buffer to store the name of the convar. |
|
ds@1952
|
597 |
* @param maxlength Maximum length of string buffer. |
|
ds@1952
|
598 |
* @noreturn |
|
ds@1952
|
599 |
* @error Invalid or corrupt Handle. |
|
ds@1952
|
600 |
*/ |
|
ds@1952
|
601 |
native GetConVarName(Handle:convar, const String:name[], maxlength); |
|
ds@1952
|
602 |
|
|
ds@1952
|
603 |
funcenum ConVarQueryFinished |
|
ds@1952
|
604 |
{ |
|
ds@1952
|
605 |
/** |
|
ds@1952
|
606 |
* Called when a query to retrieve a client's console variable has finished. |
|
ds@1952
|
607 |
* |
|
ds@1952
|
608 |
* @param cookie Unique identifier of query. |
|
ds@1952
|
609 |
* @param client Player index. |
|
ds@1952
|
610 |
* @param result Result of query that tells one whether or not query was successful. |
|
ds@1952
|
611 |
* See ConVarQueryResult enum for more details. |
|
ds@1952
|
612 |
* @param convarName Name of client convar that was queried. |
|
ds@1952
|
613 |
* @param convarValue Value of client convar that was queried if successful. This will be "" if it was not. |
|
ds@1952
|
614 |
* @param value Value that was passed when query was started. |
|
ds@1952
|
615 |
* @noreturn |
|
ds@1952
|
616 |
*/ |
|
ds@1952
|
617 |
public(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[], any:value), |
|
ds@1952
|
618 |
|
|
ds@1952
|
619 |
/** |
|
ds@1952
|
620 |
* Called when a query to retrieve a client's console variable has finished. |
|
ds@1952
|
621 |
* |
|
ds@1952
|
622 |
* @param cookie Unique identifier of query. |
|
ds@1952
|
623 |
* @param client Player index. |
|
ds@1952
|
624 |
* @param result Result of query that tells one whether or not query was successful. |
|
ds@1952
|
625 |
* See ConVarQueryResult enum for more details. |
|
ds@1952
|
626 |
* @param convarName Name of client convar that was queried. |
|
ds@1952
|
627 |
* @param convarValue Value of client convar that was queried if successful. This will be "" if it was not. |
|
ds@1952
|
628 |
* @noreturn |
|
ds@1952
|
629 |
*/ |
|
ds@1952
|
630 |
public(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[]) |
|
ds@1952
|
631 |
}; |
|
ds@1952
|
632 |
|
|
ds@1952
|
633 |
/** |
|
ds@1952
|
634 |
* Starts a query to retrieve the value of a client's console variable. |
|
ds@1952
|
635 |
* |
|
ds@1952
|
636 |
* @param client Player index. |
|
ds@1952
|
637 |
* @param name Name of client convar to query. |
|
ds@1952
|
638 |
* @param callback A function to use as a callback when the query has finished. |
|
ds@1952
|
639 |
* @param value Optional value to pass to the callback function. |
|
ds@1952
|
640 |
* @return A cookie that uniquely identifies the query. |
|
ds@1952
|
641 |
* Returns QUERYCOOKIE_FAILED on failure, such as when used on a bot. |
|
ds@1952
|
642 |
*/ |
|
ds@1952
|
643 |
native QueryCookie:QueryClientConVar(client, const String:cvarName[], ConVarQueryFinished:callback, any:value=0); |
|
ds@1952
|
644 |
|
|
ds@1952
|
645 |
/** |
|
ds@1952
|
646 |
* Gets a command iterator. Must be freed with CloseHandle(). |
|
ds@1952
|
647 |
* |
|
ds@1952
|
648 |
* @return A new command iterator. |
|
ds@1952
|
649 |
*/ |
|
ds@1952
|
650 |
native Handle:GetCommandIterator(); |
|
ds@1952
|
651 |
|
|
ds@1952
|
652 |
/** |
|
ds@1952
|
653 |
* Reads a command iterator, then advances to the next command if any. |
|
ds@1952
|
654 |
* Only SourceMod specific commands are returned. |
|
ds@1952
|
655 |
* |
|
ds@1952
|
656 |
* @param iter Command iterator Handle. |
|
ds@1952
|
657 |
* @param name Name buffer. |
|
ds@1952
|
658 |
* @param nameLen Name buffer size. |
|
ds@1952
|
659 |
* @param eflags Effective default flags of a command. |
|
ds@1952
|
660 |
* @param desc Command description buffer. |
|
ds@1952
|
661 |
* @param descLen Command description buffer size. |
|
ds@1952
|
662 |
* @return True on success, false if there are no more commands. |
|
ds@1952
|
663 |
*/ |
|
ds@1952
|
664 |
native bool:ReadCommandIterator(Handle:iter, |
|
ds@1952
|
665 |
String:name[], |
|
ds@1952
|
666 |
nameLen, |
|
ds@1952
|
667 |
&eflags=0, |
|
ds@1952
|
668 |
String:desc[]="", |
|
ds@1952
|
669 |
descLen=0); |
|
ds@1952
|
670 |
|
|
ds@1952
|
671 |
/** |
|
ds@1952
|
672 |
* Returns whether a client has access to a given command string. The string |
|
ds@1952
|
673 |
* can also be any override string, as overrides can be independent of |
|
ds@1952
|
674 |
* commands. This important feature essentially allows you to create custom |
|
ds@1952
|
675 |
* flags using the override system. |
|
ds@1952
|
676 |
* |
|
ds@1952
|
677 |
* @param client Client index. |
|
ds@1952
|
678 |
* @param command Command name. If the command is not found, the default |
|
ds@1952
|
679 |
* flags are used. |
|
ds@1952
|
680 |
* @param flags Flag string to use as a default, if the command or override |
|
ds@1952
|
681 |
* is not found. |
|
ds@1952
|
682 |
* @param override_only If true, SourceMod will not attempt to find a matching |
|
ds@1952
|
683 |
* command, and it will only use the default flags specified. |
|
ds@1952
|
684 |
* Otherwise, SourceMod will ignore the default flags if |
|
ds@1952
|
685 |
* there is a matching admin command. |
|
ds@1952
|
686 |
* @return True if the client has access, false otherwise. |
|
ds@1952
|
687 |
*/ |
|
ds@1952
|
688 |
native bool:CheckCommandAccess(client, |
|
ds@1952
|
689 |
const String:command[], |
|
ds@1952
|
690 |
flags, |
|
ds@1952
|
691 |
bool:override_only=false); |
|
ds@1952
|
692 |
|
|
ds@1952
|
693 |
/** |
|
ds@1952
|
694 |
* Returns true if the supplied character is valid in a ConVar name. |
|
ds@1952
|
695 |
* |
|
ds@1952
|
696 |
* @param c Character to validate. |
|
ds@1952
|
697 |
* @return True is valid for ConVars, false otherwise |
|
ds@1952
|
698 |
*/ |
|
ds@1952
|
699 |
stock bool:IsValidConVarChar(c) |
|
ds@1952
|
700 |
{ |
|
ds@1952
|
701 |
return (c == '_' || IsCharAlpha(c) || IsCharNumeric(c)); |
|
ds@1952
|
702 |
} |
|
ds@1952
|
703 |
|
|
ds@1952
|
704 |
/** |
|
ds@1952
|
705 |
* Returns the bitstring of flags of a command. |
|
ds@1952
|
706 |
* |
|
ds@1952
|
707 |
* @param name Name of the command. |
|
ds@1952
|
708 |
* @return A bitstring containing the FCVAR_* flags that are enabled |
|
ds@1952
|
709 |
* or INVALID_FCVAR_FLAGS if command not found. |
|
ds@1952
|
710 |
*/ |
|
ds@1952
|
711 |
native GetCommandFlags(const String:name[]); |
|
ds@1952
|
712 |
|
|
ds@1952
|
713 |
/** |
|
ds@1952
|
714 |
* Sets the bitstring of flags of a command. |
|
ds@1952
|
715 |
* |
|
ds@1952
|
716 |
* @param name Name of the command. |
|
ds@1952
|
717 |
* @param flags A bitstring containing the FCVAR_* flags to enable. |
|
ds@1952
|
718 |
* @return True on success, otherwise false. |
|
ds@1952
|
719 |
*/ |
|
ds@1952
|
720 |
native bool:SetCommandFlags(const String:name[], flags); |
|
ds@1952
|
721 |
|
|
ds@1952
|
722 |
/** |
|
ds@1952
|
723 |
* Starts a ConCommandBase search, traversing the list of ConVars and |
|
ds@1952
|
724 |
* ConCommands. If a Handle is returned, the next entry must be read |
|
ds@1952
|
725 |
* via FindNextConCommand(). The order of the list is undefined. |
|
ds@1952
|
726 |
* |
|
ds@1952
|
727 |
* @param buffer Buffer to store entry name. |
|
ds@1952
|
728 |
* @param max_size Maximum size of the buffer. |
|
ds@1952
|
729 |
* @param isCommand Variable to store whether the entry is a command. |
|
ds@1952
|
730 |
* If it is not a command, it is a ConVar. |
|
ds@1952
|
731 |
* @param flags Variable to store entry flags. |
|
ds@1952
|
732 |
* @param description Buffer to store the description, empty if no description present. |
|
ds@1952
|
733 |
* @param descrmax_size Maximum size of the description buffer. |
|
ds@1952
|
734 |
* @return On success, a ConCmdIter Handle is returned, which |
|
ds@1952
|
735 |
* can be read via FindNextConCommand(), and must be |
|
ds@1952
|
736 |
* closed via CloseHandle(). Additionally, the output |
|
ds@1952
|
737 |
* parameters will be filled with information of the |
|
ds@1952
|
738 |
* first ConCommandBase entry. |
|
ds@1952
|
739 |
* On failure, INVALID_HANDLE is returned, and the |
|
ds@1952
|
740 |
* contents of outputs is undefined. |
|
ds@1952
|
741 |
*/ |
|
ds@1952
|
742 |
native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0); |
|
ds@1952
|
743 |
|
|
ds@1952
|
744 |
/** |
|
ds@1952
|
745 |
* Reads the next entry in a ConCommandBase iterator. |
|
ds@1952
|
746 |
* |
|
ds@1952
|
747 |
* @param search ConCmdIter Handle to search. |
|
ds@1952
|
748 |
* @param buffer Buffer to store entry name. |
|
ds@1952
|
749 |
* @param max_size Maximum size of the buffer. |
|
ds@1952
|
750 |
* @param isCommand Variable to store whether the entry is a command. |
|
ds@1952
|
751 |
* If it is not a command, it is a ConVar. |
|
ds@1952
|
752 |
* @param flags Variable to store entry flags. |
|
ds@1952
|
753 |
* @param description Buffer to store the description, empty if no description present. |
|
ds@1952
|
754 |
* @param descrmax_size Maximum size of the description buffer. |
|
ds@1952
|
755 |
* @return On success, the outputs are filled, the iterator is |
|
ds@1952
|
756 |
* advanced to the next entry, and true is returned. |
|
ds@1952
|
757 |
* If no more entries exist, false is returned, and the |
|
ds@1952
|
758 |
* contents of outputs is undefined. |
|
ds@1952
|
759 |
*/ |
|
ds@1952
|
760 |
native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0); |
|
ds@1952
|
761 |
|
|
ds@1952
|
762 |
/** |
|
ds@1952
|
763 |
* Replicates a convar value to a specific client. This does not change the actual convar value. |
|
ds@1952
|
764 |
* |
|
ds@1952
|
765 |
* @param client Client index |
|
ds@1952
|
766 |
* @param convar ConVar handle |
|
ds@1952
|
767 |
* @param value String value to send |
|
ds@1952
|
768 |
* @return True on success, false on failure |
|
ds@1952
|
769 |
* @error Invalid client index, client not in game, or client is fake |
|
ds@1952
|
770 |
*/ |
|
ds@1952
|
771 |
native bool:SendConVarValue(client, Handle:convar, const String:value[]); |