|
dvander@545
|
1 |
/** |
|
dvander@545
|
2 |
* vim: set ts=4 : |
|
dvander@545
|
3 |
* =============================================================== |
|
dvander@545
|
4 |
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved. |
|
dvander@545
|
5 |
* =============================================================== |
|
dvander@545
|
6 |
* |
|
dvander@545
|
7 |
* This file is part of the SourceMod/SourcePawn SDK. This file may only be used |
|
dvander@545
|
8 |
* or modified under the Terms and Conditions of its License Agreement, which is found |
|
dvander@545
|
9 |
* in LICENSE.txt. The Terms and Conditions for making SourceMod extensions/plugins |
|
dvander@545
|
10 |
* may change at any time. To view the latest information, see: |
|
dvander@545
|
11 |
* http://www.sourcemod.net/license.php |
|
dvander@545
|
12 |
* |
|
dvander@545
|
13 |
* Version: $Id$ |
|
dvander@545
|
14 |
*/ |
|
dvander@545
|
15 |
|
|
dvander@545
|
16 |
#if defined _clients_included |
|
dvander@545
|
17 |
#endinput |
|
dvander@545
|
18 |
#endif |
|
dvander@545
|
19 |
#define _clients_included |
|
dvander@545
|
20 |
|
|
faluco@682
|
21 |
enum NetFlow |
|
faluco@682
|
22 |
{ |
|
faluco@682
|
23 |
NetFlow_Outgoing = 0, /**< Outgoing traffic */ |
|
faluco@682
|
24 |
NetFlow_Incoming, /**< Incoming traffic */ |
|
faluco@682
|
25 |
NetFlow_Both /**< Incoming and outgoing traffic */ |
|
faluco@682
|
26 |
}; |
|
faluco@682
|
27 |
|
|
dvander@545
|
28 |
/** |
|
dvander@545
|
29 |
* Called on client connection. |
|
dvander@545
|
30 |
* |
|
dvander@545
|
31 |
* @param client Player index. |
|
dvander@545
|
32 |
* @param rejectmsg Buffer to store the rejection message when the connection is refused. |
|
dvander@545
|
33 |
* @param maxlen Maximum number of characters for rejection buffer. |
|
dvander@545
|
34 |
* @return True to validate client's connection, false to refuse it. |
|
dvander@545
|
35 |
*/ |
|
dvander@545
|
36 |
forward bool:OnClientConnect(client, String:rejectmsg[], maxlen); |
|
dvander@545
|
37 |
|
|
dvander@545
|
38 |
/** |
|
dvander@545
|
39 |
* Called when a client is entering to the game. |
|
dvander@545
|
40 |
* |
|
dvander@545
|
41 |
* @param client Player index. |
|
dvander@545
|
42 |
* @noreturn |
|
dvander@545
|
43 |
*/ |
|
dvander@545
|
44 |
forward OnClientPutInServer(client); |
|
dvander@545
|
45 |
|
|
dvander@545
|
46 |
/** |
|
dvander@545
|
47 |
* Called when a client is disconnecting from the server. |
|
dvander@545
|
48 |
* |
|
dvander@545
|
49 |
* @param client Player index. |
|
dvander@545
|
50 |
* @noreturn |
|
dvander@545
|
51 |
*/ |
|
dvander@545
|
52 |
forward OnClientDisconnect(client); |
|
dvander@545
|
53 |
|
|
dvander@545
|
54 |
/** |
|
dvander@545
|
55 |
* Called when a client is disconnected from the server. |
|
dvander@545
|
56 |
* |
|
dvander@545
|
57 |
* @param client Player index. |
|
dvander@545
|
58 |
* @noreturn |
|
dvander@545
|
59 |
*/ |
|
dvander@545
|
60 |
forward OnClientDisconnect_Post(client); |
|
dvander@545
|
61 |
|
|
dvander@545
|
62 |
/** |
|
dvander@545
|
63 |
* Called when a client is sending a command. |
|
dvander@545
|
64 |
* |
|
dvander@545
|
65 |
* @param client Player index. |
|
dvander@545
|
66 |
* @param args Number of arguments. |
|
dvander@545
|
67 |
* @noreturn |
|
dvander@545
|
68 |
*/ |
|
dvander@545
|
69 |
forward Action:OnClientCommand(client, args); |
|
dvander@545
|
70 |
|
|
dvander@545
|
71 |
/** |
|
dvander@545
|
72 |
* Called whenever the client's settings are changed. |
|
dvander@545
|
73 |
* |
|
dvander@545
|
74 |
* @param client Player index. |
|
dvander@545
|
75 |
* @noreturn |
|
dvander@545
|
76 |
*/ |
|
dvander@545
|
77 |
forward OnClientSettingsChanged(client); |
|
dvander@545
|
78 |
|
|
dvander@545
|
79 |
/** |
|
dvander@545
|
80 |
* Called when a client receives a Steam ID. |
|
dvander@545
|
81 |
* @note This is called by bots, but the ID will be "BOT" |
|
dvander@545
|
82 |
* |
|
dvander@545
|
83 |
* @param client Player index. |
|
dvander@545
|
84 |
* @param auth Player auth string. |
|
dvander@545
|
85 |
*/ |
|
dvander@545
|
86 |
forward OnClientAuthorized(client, const String:auth[]); |
|
dvander@545
|
87 |
|
|
dvander@545
|
88 |
/** |
|
dvander@545
|
89 |
* Returns the maximum number of clients allowed on the server. |
|
dvander@545
|
90 |
* |
|
dvander@545
|
91 |
* @return Maximum number of clients allowed. |
|
dvander@545
|
92 |
*/ |
|
dvander@545
|
93 |
native GetMaxClients(); |
|
dvander@545
|
94 |
|
|
dvander@545
|
95 |
/** |
|
dvander@545
|
96 |
* Returns the client count put in the server. |
|
dvander@545
|
97 |
* |
|
dvander@545
|
98 |
* @param inGameOnly If false connecting players are also counted. |
|
dvander@545
|
99 |
* @return Client count in the server. |
|
dvander@545
|
100 |
*/ |
|
dvander@545
|
101 |
native GetClientCount(bool:inGameOnly=true); |
|
dvander@545
|
102 |
|
|
dvander@545
|
103 |
/** |
|
dvander@545
|
104 |
* Returns the client's name. |
|
dvander@545
|
105 |
* |
|
dvander@545
|
106 |
* @param client Player index. |
|
dvander@545
|
107 |
* @param name Buffer to store the client's name. |
|
dvander@545
|
108 |
* @param maxlen Maximum length of string buffer (includes NULL terminator). |
|
dvander@545
|
109 |
* @return True on success, false otherwise. |
|
dvander@545
|
110 |
* @error If the client is not connected an error will be thrown. |
|
dvander@545
|
111 |
*/ |
|
dvander@545
|
112 |
native bool:GetClientName(client, String:name[], maxlen); |
|
dvander@545
|
113 |
|
|
dvander@545
|
114 |
/** |
|
dvander@545
|
115 |
* Retrieves a client's IP address. |
|
dvander@545
|
116 |
* |
|
dvander@545
|
117 |
* @param client Player index. |
|
dvander@545
|
118 |
* @param name Buffer to store the client's ip address. |
|
dvander@545
|
119 |
* @param maxlen Maximum length of string buffer (includes NULL terminator). |
|
dvander@545
|
120 |
* @param remport Remove client's port from the ip string (true by default). |
|
dvander@545
|
121 |
* @return True on success, false otherwise. |
|
dvander@545
|
122 |
* @error If the client is not connected or the index is invalid. |
|
dvander@545
|
123 |
*/ |
|
dvander@545
|
124 |
native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true); |
|
dvander@545
|
125 |
|
|
dvander@545
|
126 |
/** |
|
dvander@545
|
127 |
* Retrieves a client's authentication string (SteamID). |
|
dvander@545
|
128 |
* |
|
dvander@545
|
129 |
* @param client Player index. |
|
dvander@545
|
130 |
* @param auth Buffer to store the client's auth string. |
|
dvander@545
|
131 |
* @param maxlen Maximum length of string buffer (includes NULL terminator). |
|
dvander@545
|
132 |
* @return True on success, false otherwise. |
|
dvander@545
|
133 |
* @error If the client is not connected or the index is invalid. |
|
dvander@545
|
134 |
*/ |
|
dvander@545
|
135 |
native bool:GetClientAuthString(client, String:auth[], maxlen); |
|
dvander@545
|
136 |
|
|
dvander@545
|
137 |
/** |
|
dvander@545
|
138 |
* Retrieves a client's user id, which is an index incremented for every client |
|
dvander@545
|
139 |
* that joins the server. |
|
dvander@545
|
140 |
* |
|
dvander@545
|
141 |
* @param client Player index. |
|
dvander@545
|
142 |
* @return User id of the client. |
|
dvander@545
|
143 |
* @error If the client is not connected or the index is invalid. |
|
dvander@545
|
144 |
*/ |
|
dvander@545
|
145 |
native GetClientUserId(client); |
|
dvander@545
|
146 |
|
|
dvander@545
|
147 |
/** |
|
dvander@545
|
148 |
* Returns if a certain player is connected. |
|
dvander@545
|
149 |
* |
|
dvander@545
|
150 |
* @param client Player index. |
|
dvander@545
|
151 |
* @return True if player is connected to the server, false otherwise. |
|
dvander@545
|
152 |
*/ |
|
dvander@545
|
153 |
native bool:IsClientConnected(client); |
|
dvander@545
|
154 |
|
|
dvander@545
|
155 |
/** |
|
dvander@545
|
156 |
* Returns if a certain player has entered the game. |
|
dvander@545
|
157 |
* |
|
dvander@545
|
158 |
* @param client Player index. |
|
dvander@545
|
159 |
* @return True if player has entered the game, false otherwise. |
|
dvander@545
|
160 |
*/ |
|
ds@784
|
161 |
native bool:IsClientInGame(client); |
|
ds@784
|
162 |
|
|
ds@784
|
163 |
/** |
|
ds@784
|
164 |
* Backwards compatibility stock - use IsClientInGame |
|
ds@784
|
165 |
* @deprecated Renamed to IsClientInGame |
|
ds@784
|
166 |
*/ |
|
ds@784
|
167 |
stock bool:IsPlayerInGame(client) |
|
ds@784
|
168 |
{ |
|
ds@784
|
169 |
return IsClientInGame(client); |
|
ds@784
|
170 |
} |
|
dvander@545
|
171 |
|
|
dvander@545
|
172 |
/** |
|
dvander@545
|
173 |
* Returns if a certain player has been authenticated. |
|
dvander@545
|
174 |
* |
|
dvander@545
|
175 |
* @param client Player index. |
|
dvander@545
|
176 |
* @return True if player has been authenticated, false otherwise. |
|
dvander@545
|
177 |
*/ |
|
dvander@545
|
178 |
native bool:IsClientAuthorized(client); |
|
dvander@545
|
179 |
|
|
dvander@545
|
180 |
/** |
|
dvander@545
|
181 |
* Returns if a certain player is a fake client. |
|
dvander@545
|
182 |
* |
|
dvander@545
|
183 |
* @param client Player index. |
|
dvander@545
|
184 |
* @return True if player is a fake client, false otherwise. |
|
dvander@545
|
185 |
*/ |
|
dvander@545
|
186 |
native bool:IsFakeClient(client); |
|
dvander@545
|
187 |
|
|
dvander@545
|
188 |
/** |
|
dvander@545
|
189 |
* Retrieves values from client replicated keys. |
|
dvander@545
|
190 |
* |
|
dvander@545
|
191 |
* @param client Player's index. |
|
dvander@545
|
192 |
* @param key Key string. |
|
dvander@545
|
193 |
* @param value Buffer to store value. |
|
dvander@545
|
194 |
* @param maxlen Maximum length of valve (UTF-8 safe). |
|
dvander@545
|
195 |
* @return True on success, false otherwise. |
|
dvander@545
|
196 |
* @error Invalid client index, or client not connected. |
|
dvander@545
|
197 |
*/ |
|
dvander@545
|
198 |
native bool:GetClientInfo(client, const String:key[], String:value[], maxlen); |
|
dvander@545
|
199 |
|
|
dvander@545
|
200 |
/** |
|
dvander@644
|
201 |
* Retrieves a client's team index. |
|
dvander@644
|
202 |
* |
|
dvander@644
|
203 |
* @param client Player's index. |
|
dvander@644
|
204 |
* @return Team index the client is on (mod specific). |
|
dvander@644
|
205 |
* @error Invalid client index, client not in game, or no mod support. |
|
dvander@644
|
206 |
*/ |
|
dvander@644
|
207 |
native GetClientTeam(client); |
|
dvander@644
|
208 |
|
|
dvander@644
|
209 |
/** |
|
dvander@545
|
210 |
* Sets a client's AdminId. |
|
dvander@545
|
211 |
* |
|
dvander@545
|
212 |
* @param client Player's index. |
|
dvander@545
|
213 |
* @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions. |
|
dvander@545
|
214 |
* @param temp True if the id should be freed on disconnect. |
|
dvander@545
|
215 |
* @noreturn |
|
dvander@545
|
216 |
* @error Invalid client index, client not connected, or bogus AdminId. |
|
dvander@545
|
217 |
*/ |
|
dvander@545
|
218 |
native SetUserAdmin(client, AdminId:id, bool:temp=false); |
|
dvander@545
|
219 |
|
|
dvander@545
|
220 |
/** |
|
dvander@545
|
221 |
* Retrieves a client's AdminId. |
|
dvander@545
|
222 |
* |
|
dvander@545
|
223 |
* @param client Player's index. |
|
dvander@545
|
224 |
* @return AdminId of the client, or INVALID_ADMIN_ID if none. |
|
dvander@545
|
225 |
* @error Invalid client index, or client not connected. |
|
dvander@545
|
226 |
*/ |
|
dvander@545
|
227 |
native AdminId:GetUserAdmin(client); |
|
dvander@545
|
228 |
|
|
dvander@545
|
229 |
/** |
|
dvander@545
|
230 |
* Sets access flags on a client. If the client is not an admin, |
|
dvander@545
|
231 |
* a temporary, anonymous AdminId is given. |
|
dvander@545
|
232 |
* |
|
dvander@545
|
233 |
* @param client Player's index. |
|
dvander@545
|
234 |
* @param ... Flags to set on the client. |
|
dvander@545
|
235 |
* @noreturn |
|
dvander@545
|
236 |
* @error Invalid client index, or client not connected. |
|
dvander@545
|
237 |
*/ |
|
ds@634
|
238 |
native AddUserFlags(client, AdminFlag:...); |
|
dvander@545
|
239 |
|
|
dvander@545
|
240 |
/** |
|
dvander@545
|
241 |
* Removes flags from a client. If the client is not an admin, |
|
dvander@545
|
242 |
* this has no effect. |
|
dvander@545
|
243 |
* |
|
dvander@545
|
244 |
* @param client Player's index. |
|
dvander@545
|
245 |
* @param ... Flags to remove from the client. |
|
dvander@545
|
246 |
* @noreturn |
|
dvander@545
|
247 |
* @error Invalid client index, or client not connected. |
|
dvander@545
|
248 |
*/ |
|
ds@634
|
249 |
native RemoveUserFlags(client, AdminFlag:...); |
|
dvander@545
|
250 |
|
|
dvander@545
|
251 |
/** |
|
dvander@545
|
252 |
* Sets access flags on a client using bits instead of flags. If the |
|
dvander@545
|
253 |
* client is not an admin, and flags not 0, a temporary, anonymous AdminId is given. |
|
dvander@545
|
254 |
* |
|
dvander@545
|
255 |
* @param client Player's index. |
|
dvander@545
|
256 |
* @param flags Bitstring of flags to set on client. |
|
dvander@545
|
257 |
* @noreturn |
|
dvander@545
|
258 |
*/ |
|
dvander@545
|
259 |
native SetUserFlagBits(client, flags); |
|
dvander@545
|
260 |
|
|
dvander@545
|
261 |
/** |
|
dvander@545
|
262 |
* Returns client access flags. If the client is not an admin, |
|
dvander@545
|
263 |
* the result is always 0. |
|
dvander@545
|
264 |
* |
|
dvander@545
|
265 |
* @param client Player's index. |
|
dvander@545
|
266 |
* @return Flags |
|
dvander@545
|
267 |
* @error Invalid client index, or client not connected. |
|
dvander@545
|
268 |
*/ |
|
dvander@545
|
269 |
native GetUserFlagBits(client); |
|
dvander@545
|
270 |
|
|
dvander@545
|
271 |
/** |
|
dvander@545
|
272 |
* Returns whether a user can target another user. |
|
dvander@545
|
273 |
* This is a helper function for CanAdminTarget. |
|
dvander@545
|
274 |
* |
|
dvander@545
|
275 |
* @param client Player's index. |
|
dvander@545
|
276 |
* @param target Target player's index. |
|
dvander@545
|
277 |
* @return True if target is targettable by the player, false otherwise. |
|
dvander@545
|
278 |
* @error Invalid or unconnected player indexers. |
|
dvander@545
|
279 |
*/ |
|
dvander@545
|
280 |
native bool:CanUserTarget(client, target); |
|
dvander@545
|
281 |
|
|
dvander@545
|
282 |
/** |
|
dvander@545
|
283 |
* Creates a fake client. |
|
dvander@545
|
284 |
* |
|
dvander@545
|
285 |
* @param name Name to use. |
|
dvander@545
|
286 |
* @return Client index on success, 0 otherwise. |
|
dvander@545
|
287 |
*/ |
|
dvander@545
|
288 |
native CreateFakeClient(const String:name[]); |
|
dvander@545
|
289 |
|
|
dvander@545
|
290 |
/** |
|
dvander@545
|
291 |
* Sets a convar value on a fake client. |
|
dvander@545
|
292 |
* |
|
dvander@545
|
293 |
* @param client Client index. |
|
dvander@545
|
294 |
* @param cvar ConVar name. |
|
dvander@545
|
295 |
* @param value ConVar value. |
|
dvander@545
|
296 |
* @noreturn |
|
dvander@545
|
297 |
* @error Invalid client index, client not connected, |
|
dvander@545
|
298 |
* or client not a fake client. |
|
dvander@545
|
299 |
*/ |
|
ds@621
|
300 |
native SetFakeClientConVar(client, const String:cvar[], const String:value[]); |
|
faluco@658
|
301 |
|
|
faluco@658
|
302 |
/** |
|
faluco@658
|
303 |
* Returns the client's health. |
|
faluco@658
|
304 |
* |
|
faluco@658
|
305 |
* @param client Player's index. |
|
faluco@658
|
306 |
* @return Health value. |
|
faluco@658
|
307 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
308 |
*/ |
|
faluco@658
|
309 |
native GetClientHealth(client); |
|
faluco@658
|
310 |
|
|
faluco@658
|
311 |
/** |
|
faluco@658
|
312 |
* Returns the client's model name. |
|
faluco@658
|
313 |
* |
|
faluco@658
|
314 |
* @param client Player's index. |
|
faluco@658
|
315 |
* @param model Buffer to store the client's model name. |
|
faluco@658
|
316 |
* @param maxlen Maximum length of string buffer (includes NULL terminator). |
|
faluco@658
|
317 |
* @noreturn |
|
faluco@658
|
318 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
319 |
*/ |
|
faluco@658
|
320 |
native GetClientModel(client, String:model[], maxlen); |
|
faluco@658
|
321 |
|
|
faluco@658
|
322 |
/** |
|
faluco@658
|
323 |
* Returns the client's weapon name. |
|
faluco@658
|
324 |
* |
|
faluco@658
|
325 |
* @param client Player's index. |
|
faluco@658
|
326 |
* @param weapon Buffer to store the client's weapon name. |
|
faluco@658
|
327 |
* @param maxlen Maximum length of string buffer (includes NULL terminator). |
|
faluco@658
|
328 |
* @noreturn |
|
faluco@658
|
329 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
330 |
*/ |
|
faluco@658
|
331 |
native GetClientWeapon(client, String:weapon[], maxlen); |
|
faluco@658
|
332 |
|
|
faluco@658
|
333 |
/** |
|
faluco@658
|
334 |
* Returns the client's max size vector. |
|
faluco@658
|
335 |
* |
|
faluco@658
|
336 |
* @param client Player's index. |
|
faluco@658
|
337 |
* @param vec Destination vector to store the client's max size. |
|
faluco@658
|
338 |
* @noreturn |
|
faluco@658
|
339 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
340 |
*/ |
|
faluco@658
|
341 |
native GetClientMaxs(client, Float:vec[3]); |
|
faluco@658
|
342 |
|
|
faluco@658
|
343 |
/** |
|
faluco@658
|
344 |
* Returns the client's min size vector. |
|
faluco@658
|
345 |
* |
|
faluco@658
|
346 |
* @param client Player's index. |
|
faluco@658
|
347 |
* @param vec Destination vector to store the client's min size. |
|
faluco@658
|
348 |
* @noreturn |
|
faluco@658
|
349 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
350 |
*/ |
|
faluco@658
|
351 |
native GetClientMins(client, Float:vec[3]); |
|
faluco@658
|
352 |
|
|
faluco@658
|
353 |
/** |
|
faluco@658
|
354 |
* Returns the client's position angle. |
|
faluco@658
|
355 |
* |
|
faluco@658
|
356 |
* @param client Player's index. |
|
faluco@658
|
357 |
* @param ang Destination vector to store the client's position angle. |
|
faluco@658
|
358 |
* @noreturn |
|
faluco@658
|
359 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
360 |
*/ |
|
faluco@658
|
361 |
native GetClientAbsAngles(client, Float:ang[3]); |
|
faluco@658
|
362 |
|
|
faluco@658
|
363 |
/** |
|
faluco@658
|
364 |
* Returns the client's origin vector. |
|
faluco@658
|
365 |
* |
|
faluco@658
|
366 |
* @param client Player's index. |
|
faluco@658
|
367 |
* @param vec Destination vector to store the client's origin vector. |
|
faluco@658
|
368 |
* @noreturn |
|
faluco@658
|
369 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
370 |
*/ |
|
faluco@658
|
371 |
native GetClientAbsOrigin(client, Float:vec[3]); |
|
faluco@658
|
372 |
|
|
faluco@658
|
373 |
/** |
|
faluco@658
|
374 |
* Returns the client's armor. |
|
faluco@658
|
375 |
* |
|
faluco@658
|
376 |
* @param client Player's index. |
|
faluco@658
|
377 |
* @return Armor value. |
|
faluco@658
|
378 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
379 |
*/ |
|
faluco@658
|
380 |
native GetClientArmor(client); |
|
faluco@658
|
381 |
|
|
faluco@658
|
382 |
/** |
|
faluco@658
|
383 |
* Returns the client's death count. |
|
faluco@658
|
384 |
* |
|
faluco@658
|
385 |
* @param client Player's index. |
|
faluco@658
|
386 |
* @return Death count. |
|
faluco@658
|
387 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
388 |
*/ |
|
faluco@658
|
389 |
native GetClientDeaths(client); |
|
faluco@658
|
390 |
|
|
faluco@658
|
391 |
/** |
|
faluco@658
|
392 |
* Returns the client's frag count. |
|
faluco@658
|
393 |
* |
|
faluco@658
|
394 |
* @param client Player's index. |
|
faluco@658
|
395 |
* @return Frag count. |
|
faluco@658
|
396 |
* @error Invalid client index, client not in game, or no mod support. |
|
faluco@658
|
397 |
*/ |
|
faluco@658
|
398 |
native GetClientFrags(client); |
|
faluco@682
|
399 |
|
|
faluco@682
|
400 |
/** |
|
faluco@682
|
401 |
* Returns the client's send data rate in bytes/sec. |
|
faluco@682
|
402 |
* |
|
faluco@682
|
403 |
* @param client Player's index. |
|
faluco@682
|
404 |
* @return Data rate. |
|
faluco@682
|
405 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
406 |
*/ |
|
dvander@691
|
407 |
native GetClientDataRate(client); |
|
faluco@682
|
408 |
|
|
faluco@682
|
409 |
/** |
|
faluco@682
|
410 |
* Returns if a client is timing out |
|
faluco@682
|
411 |
* |
|
faluco@682
|
412 |
* @param client Player's index. |
|
faluco@682
|
413 |
* @return True if client is timing out, false otherwise. |
|
faluco@682
|
414 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
415 |
*/ |
|
dvander@691
|
416 |
native bool:IsClientTimingOut(client); |
|
faluco@682
|
417 |
|
|
faluco@682
|
418 |
/** |
|
faluco@682
|
419 |
* Returns the client's connection time in seconds. |
|
faluco@682
|
420 |
* |
|
faluco@682
|
421 |
* @param client Player's index. |
|
faluco@682
|
422 |
* @return Connection time. |
|
faluco@682
|
423 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
424 |
*/ |
|
dvander@691
|
425 |
native Float:GetClientTime(client); |
|
faluco@682
|
426 |
|
|
faluco@682
|
427 |
/** |
|
faluco@682
|
428 |
* Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering. |
|
faluco@682
|
429 |
* |
|
faluco@682
|
430 |
* @param client Player's index. |
|
faluco@682
|
431 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
432 |
* @return Latency. |
|
faluco@682
|
433 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
434 |
*/ |
|
dvander@691
|
435 |
native Float:GetClientLatency(client, NetFlow:flow); |
|
faluco@682
|
436 |
|
|
faluco@682
|
437 |
/** |
|
faluco@682
|
438 |
* Returns the client's average packet latency in seconds. |
|
faluco@682
|
439 |
* |
|
faluco@682
|
440 |
* @param client Player's index. |
|
faluco@682
|
441 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
442 |
* @return Average latency. |
|
faluco@682
|
443 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
444 |
*/ |
|
dvander@691
|
445 |
native Float:GetClientAvgLatency(client, NetFlow:flow); |
|
faluco@682
|
446 |
|
|
faluco@682
|
447 |
/** |
|
faluco@682
|
448 |
* Returns the client's average packet loss, values go from 0 to 1 (for percentages). |
|
faluco@682
|
449 |
* |
|
faluco@682
|
450 |
* @param client Player's index. |
|
faluco@682
|
451 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
452 |
* @return Average packet loss. |
|
faluco@682
|
453 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
454 |
*/ |
|
dvander@691
|
455 |
native Float:GetClientAvgLoss(client, NetFlow:flow); |
|
faluco@682
|
456 |
|
|
faluco@682
|
457 |
/** |
|
faluco@682
|
458 |
* Returns the client's average packet choke, values go from 0 to 1 (for percentages). |
|
faluco@682
|
459 |
* |
|
faluco@682
|
460 |
* @param client Player's index. |
|
faluco@682
|
461 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
462 |
* @return Average packet choke. |
|
faluco@682
|
463 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
464 |
*/ |
|
dvander@691
|
465 |
native Float:GetClientAvgChoke(client, NetFlow:flow); |
|
faluco@682
|
466 |
|
|
faluco@682
|
467 |
/** |
|
faluco@682
|
468 |
* Returns the client's data flow in bytes/sec. |
|
faluco@682
|
469 |
* |
|
faluco@682
|
470 |
* @param client Player's index. |
|
faluco@682
|
471 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
472 |
* @return Data flow. |
|
faluco@682
|
473 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
474 |
*/ |
|
dvander@691
|
475 |
native Float:GetClientAvgData(client, NetFlow:flow); |
|
faluco@682
|
476 |
|
|
faluco@682
|
477 |
/** |
|
faluco@682
|
478 |
* Returns the client's average packet frequency in packets/sec. |
|
faluco@682
|
479 |
* |
|
faluco@682
|
480 |
* @param client Player's index. |
|
faluco@682
|
481 |
* @param flow Traffic flowing direction. |
|
faluco@682
|
482 |
* @return Packet frequency. |
|
faluco@682
|
483 |
* @error Invalid client index, client not in game, or fake client. |
|
faluco@682
|
484 |
*/ |
|
dvander@691
|
485 |
native Float:GetClientAvgPackets(client, NetFlow:flow); |
|
faluco@682
|
486 |
|
|
faluco@682
|
487 |
/** |
|
faluco@682
|
488 |
* Translates an userid index to the real player index. |
|
faluco@682
|
489 |
* |
|
faluco@682
|
490 |
* @param userid Userid value. |
|
faluco@682
|
491 |
* @return Client value. |
|
faluco@682
|
492 |
* @error Returns 0 if invalid userid. |
|
faluco@682
|
493 |
*/ |
|
faluco@682
|
494 |
native GetClientOfUserId(userid); |
|
faluco@682
|
495 |
|
|
faluco@682
|
496 |
/** |
|
faluco@682
|
497 |
* Executes a client command on the server without being networked. |
|
faluco@682
|
498 |
* |
|
faluco@682
|
499 |
* @param client Index of the client. |
|
faluco@682
|
500 |
* @param fmt Format of the client command. |
|
faluco@682
|
501 |
* @param ... Format parameters |
|
faluco@682
|
502 |
* @noreturn |
|
faluco@682
|
503 |
* @error Invalid client index, or client not connected. |
|
faluco@682
|
504 |
*/ |
|
faluco@682
|
505 |
native FakeClientCommand(client, const String:fmt[], any:...); |