plugins/include/clients.inc
branchrefac-jit
changeset 2168 c24a6fa957db
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/include/clients.inc	Sun Jul 06 04:49:55 2008 +0000
     1.3 @@ -0,0 +1,684 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * =============================================================================
     1.7 + * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     1.8 + * =============================================================================
     1.9 + *
    1.10 + * This file is part of the SourceMod/SourcePawn SDK.
    1.11 + *
    1.12 + * This program is free software; you can redistribute it and/or modify it under
    1.13 + * the terms of the GNU General Public License, version 3.0, as published by the
    1.14 + * Free Software Foundation.
    1.15 + * 
    1.16 + * This program is distributed in the hope that it will be useful, but WITHOUT
    1.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.18 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.19 + * details.
    1.20 + *
    1.21 + * You should have received a copy of the GNU General Public License along with
    1.22 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.23 + *
    1.24 + * As a special exception, AlliedModders LLC gives you permission to link the
    1.25 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.26 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.27 + * by the Valve Corporation.  You must obey the GNU General Public License in
    1.28 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.29 + * this exception to all derivative works.  AlliedModders LLC defines further
    1.30 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.31 + * or <http://www.sourcemod.net/license.php>.
    1.32 + *
    1.33 + * Version: $Id$
    1.34 + */
    1.35 +
    1.36 +#if defined _clients_included
    1.37 + #endinput
    1.38 +#endif
    1.39 +#define _clients_included
    1.40 +
    1.41 +/**
    1.42 + * Network flow directions.
    1.43 + */
    1.44 +enum NetFlow
    1.45 +{
    1.46 +	NetFlow_Outgoing = 0,	/**< Outgoing traffic */
    1.47 +	NetFlow_Incoming,		/**< Incoming traffic */
    1.48 +	NetFlow_Both,			/**< Both values added together */
    1.49 +};
    1.50 +
    1.51 +#define MAXPLAYERS		64	/**< Maximum number of players that can be in server */
    1.52 +#define MAX_NAME_LENGTH 32	/**< Maximum buffer required to store a client name */
    1.53 +
    1.54 +/**
    1.55 + * Called on client connection.
    1.56 + *
    1.57 + * @param client		Client index.
    1.58 + * @param rejectmsg		Buffer to store the rejection message when the connection is refused.
    1.59 + * @param maxlen		Maximum number of characters for rejection buffer.
    1.60 + * @return				True to validate client's connection, false to refuse it.
    1.61 + */
    1.62 +forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
    1.63 +
    1.64 +/**
    1.65 + * Called when a client is entering the game.
    1.66 + *
    1.67 + * Whether a client has a steamid is undefined until OnClientAuthorized
    1.68 + * is called, which may occur either before or after OnClientPutInServer.
    1.69 + * Similarly, use OnClientPostAdminCheck() if you need to verify whether 
    1.70 + * connecting players are admins.
    1.71 + *
    1.72 + * GetClientCount() will include clients as they are passed through this 
    1.73 + * function, as clients are already in game at this point.
    1.74 + *
    1.75 + * @param client		Client index.
    1.76 + * @noreturn
    1.77 + */
    1.78 +forward OnClientPutInServer(client);
    1.79 +
    1.80 +/**
    1.81 + * Called when a client is disconnecting from the server.
    1.82 + *
    1.83 + * @param client		Client index.
    1.84 + * @noreturn
    1.85 + */
    1.86 +forward OnClientDisconnect(client);
    1.87 +
    1.88 +/**
    1.89 + * Called when a client is disconnected from the server.
    1.90 + *
    1.91 + * @param client		Client index.
    1.92 + * @noreturn
    1.93 + */
    1.94 +forward OnClientDisconnect_Post(client);
    1.95 +
    1.96 +/**
    1.97 + * Called when a client is sending a command.
    1.98 + *
    1.99 + * @param client		Client index.
   1.100 + * @param args			Number of arguments.
   1.101 + * @noreturn
   1.102 + */
   1.103 +forward Action:OnClientCommand(client, args);
   1.104 +
   1.105 +/**
   1.106 + * Called whenever the client's settings are changed.
   1.107 + *
   1.108 + * @param client		Client index.
   1.109 + * @noreturn
   1.110 + */
   1.111 +forward OnClientSettingsChanged(client);
   1.112 +
   1.113 +/**
   1.114 + * Called when a client receives a Steam ID.  The state of a client's 
   1.115 + * authorization via Steam or as an admin is not guaranteed here.  
   1.116 + * Use OnClientAuthorized() or OnClientPostAdminCheck() for those, 
   1.117 + * respectively.
   1.118 + *
   1.119 + * This is called by bots, but the ID will be "BOT".
   1.120 + *
   1.121 + * @param client		Client index.
   1.122 + * @param auth			Client auth string.
   1.123 + * @noreturn
   1.124 + */
   1.125 +forward OnClientAuthorized(client, const String:auth[]);
   1.126 +
   1.127 +/**
   1.128 + * Called once a client is authorized and fully in-game, but 
   1.129 + * before admin checks are done.  This can be used to override 
   1.130 + * the default admin checks for a client.  You should only use 
   1.131 + * this for overriding; use OnClientPostAdminCheck() instead 
   1.132 + * if you want notification.
   1.133 + *
   1.134 + * Note: If handled/blocked, PostAdminCheck must be signalled 
   1.135 + * manually via NotifyPostAdminCheck().
   1.136 + *
   1.137 + * This callback is gauranteed to occur on all clients, and always 
   1.138 + * after each OnClientPutInServer() call.
   1.139 + *
   1.140 + * @param client		Client index.
   1.141 + * @return				Plugin_Handled to block admin checks.
   1.142 + */
   1.143 +forward Action:OnClientPreAdminCheck(client);
   1.144 +
   1.145 +/**
   1.146 + * Called directly before OnClientPostAdminCheck() as a method to 
   1.147 + * alter administrative permissions before plugins perform final 
   1.148 + * post-connect operations.  
   1.149 + *
   1.150 + * In general, do not use this function unless you are specifically 
   1.151 + * attempting to change access permissions.  Use OnClientPostAdminCheck() 
   1.152 + * instead if you simply want to perform post-connect authorization 
   1.153 + * routines.
   1.154 + *
   1.155 + * See OnClientPostAdminCheck() for more information.
   1.156 + *
   1.157 + * @param client		Client index.
   1.158 + * @noreturn
   1.159 + */
   1.160 +forward OnClientPostAdminFilter(client);
   1.161 +
   1.162 +/**
   1.163 + * Called once a client is authorized and fully in-game, and 
   1.164 + * after all post-connection authorizations have been performed.  
   1.165 + *
   1.166 + * This callback is gauranteed to occur on all clients, and always 
   1.167 + * after each OnClientPutInServer() call.
   1.168 + *
   1.169 + * @param client		Client index.
   1.170 + * @noreturn
   1.171 + */
   1.172 +forward OnClientPostAdminCheck(client);
   1.173 +
   1.174 +/**
   1.175 + * Returns the maximum number of clients allowed on the server.  This may 
   1.176 + * return 0 if called before OnMapStart(), and thus should not be called 
   1.177 + * in OnPluginStart().  
   1.178 + *
   1.179 + * @return				Maximum number of clients allowed.
   1.180 + */
   1.181 +native GetMaxClients();
   1.182 +
   1.183 +/**
   1.184 + * Returns the client count put in the server.
   1.185 + *
   1.186 + * @param inGameOnly	If false connecting players are also counted.
   1.187 + * @return				Client count in the server.
   1.188 + */
   1.189 +native GetClientCount(bool:inGameOnly=true);
   1.190 +
   1.191 +/**
   1.192 + * Returns the client's name.
   1.193 + *
   1.194 + * @param client		Player index.
   1.195 + * @param name			Buffer to store the client's name.
   1.196 + * @param maxlen		Maximum length of string buffer (includes NULL terminator).
   1.197 + * @return				True on success, false otherwise.
   1.198 + * @error				If the client is not connected an error will be thrown.
   1.199 + */
   1.200 +native bool:GetClientName(client, String:name[], maxlen);
   1.201 +
   1.202 +/**
   1.203 + * Retrieves a client's IP address.
   1.204 + *
   1.205 + * @param client		Player index.
   1.206 + * @param name			Buffer to store the client's ip address.
   1.207 + * @param maxlen		Maximum length of string buffer (includes NULL terminator).
   1.208 + * @param remport		Remove client's port from the ip string (true by default).
   1.209 + * @return				True on success, false otherwise.
   1.210 + * @error				If the client is not connected or the index is invalid.
   1.211 + */
   1.212 +native bool:GetClientIP(client, String:ip[], maxlen, bool:remport=true);
   1.213 +
   1.214 +/**
   1.215 + * Retrieves a client's authentication string (SteamID).
   1.216 + *
   1.217 + * @param client		Player index.
   1.218 + * @param auth			Buffer to store the client's auth string.
   1.219 + * @param maxlen		Maximum length of string buffer (includes NULL terminator).
   1.220 + * @return				True on success, false otherwise.
   1.221 + * @error				If the client is not connected or the index is invalid.
   1.222 + */
   1.223 +native bool:GetClientAuthString(client, String:auth[], maxlen);
   1.224 +
   1.225 +/**
   1.226 + * Retrieves a client's user id, which is an index incremented for every client
   1.227 + * that joins the server.
   1.228 + *
   1.229 + * @param client		Player index.
   1.230 + * @return				User id of the client.
   1.231 + * @error 				If the client is not connected or the index is invalid.
   1.232 + */
   1.233 +native GetClientUserId(client);
   1.234 +
   1.235 +/**
   1.236 + * Returns if a certain player is connected.
   1.237 + *
   1.238 + * @param client		Player index.
   1.239 + * @return				True if player is connected to the server, false otherwise.
   1.240 + */
   1.241 +native bool:IsClientConnected(client);
   1.242 +
   1.243 +/**
   1.244 + * Returns if a certain player has entered the game.
   1.245 + *
   1.246 + * @param client		Player index (index does not have to be connected).
   1.247 + * @return				True if player has entered the game, false otherwise.
   1.248 + * @error				Invalid client index.
   1.249 + */
   1.250 +native bool:IsClientInGame(client);
   1.251 +
   1.252 +/**
   1.253 + * Returns if a client is in the "kick queue" (i.e. the client will be kicked 
   1.254 + * shortly and thus they should not appear as valid).
   1.255 + *
   1.256 + * @param client		Player index (must be connected).
   1.257 + * @return				True if in the kick queue, false otherwise.
   1.258 + * @error				Invalid client index.
   1.259 + */
   1.260 +native bool:IsClientInKickQueue(client);
   1.261 +
   1.262 +/**
   1.263 + * Backwards compatibility stock - use IsClientInGame
   1.264 + * @deprecated			Renamed to IsClientInGame
   1.265 + */
   1.266 +#pragma deprecated Use IsClientInGame() instead
   1.267 +stock bool:IsPlayerInGame(client)
   1.268 +{
   1.269 +	return IsClientInGame(client);
   1.270 +}
   1.271 +
   1.272 +/**
   1.273 + * Returns if a certain player has been authenticated.
   1.274 + *
   1.275 + * @param client		Player index.
   1.276 + * @return				True if player has been authenticated, false otherwise.
   1.277 + */
   1.278 +native bool:IsClientAuthorized(client);
   1.279 +
   1.280 +/**
   1.281 + * Returns if a certain player is a fake client.
   1.282 + *
   1.283 + * @param client		Player index.
   1.284 + * @return				True if player is a fake client, false otherwise.
   1.285 + */
   1.286 +native bool:IsFakeClient(client);
   1.287 +
   1.288 +/**
   1.289 + * Returns if a certain player is an observer/spectator.
   1.290 + *
   1.291 + * @param client		Player index.
   1.292 + * @return				True if player is an obverser, false otherwise.
   1.293 + */
   1.294 +native bool:IsClientObserver(client);
   1.295 +
   1.296 +/**
   1.297 + * Returns if the client is alive or dead.
   1.298 + *
   1.299 + * Note: This function was originally in SDKTools and was moved to core.
   1.300 + *
   1.301 + * @param client		Player's index.
   1.302 + * @return				True if the client is alive, false otherwise.
   1.303 + * @error				Invalid client index, client not in game, or no mod support.
   1.304 + */
   1.305 +native bool:IsPlayerAlive(client);
   1.306 +
   1.307 +/**
   1.308 + * Retrieves values from client replicated keys.
   1.309 + *
   1.310 + * @param client		Player's index.
   1.311 + * @param key			Key string.
   1.312 + * @param value			Buffer to store value.
   1.313 + * @param maxlen		Maximum length of valve (UTF-8 safe).
   1.314 + * @return 				True on success, false otherwise.
   1.315 + * @error				Invalid client index, or client not connected.
   1.316 + */
   1.317 +native bool:GetClientInfo(client, const String:key[], String:value[], maxlen);
   1.318 +
   1.319 +/**
   1.320 + * Retrieves a client's team index.
   1.321 + *
   1.322 + * @param client		Player's index.
   1.323 + * @return				Team index the client is on (mod specific).
   1.324 + * @error				Invalid client index, client not in game, or no mod support.
   1.325 + */
   1.326 +native GetClientTeam(client);
   1.327 + 
   1.328 +/**
   1.329 + * Sets a client's AdminId.  
   1.330 + *
   1.331 + * @param client		Player's index.
   1.332 + * @param id			AdminId to set.  INVALID_ADMIN_ID removes admin permissions.
   1.333 + * @param temp			True if the id should be freed on disconnect.
   1.334 + * @noreturn
   1.335 + * @error				Invalid client index, client not connected, or bogus AdminId.
   1.336 + */
   1.337 +native SetUserAdmin(client, AdminId:id, bool:temp=false);
   1.338 +
   1.339 +/**
   1.340 + * Retrieves a client's AdminId.
   1.341 + *
   1.342 + * @param client		Player's index.
   1.343 + * @return				AdminId of the client, or INVALID_ADMIN_ID if none.
   1.344 + * @error				Invalid client index, or client not connected.
   1.345 + */
   1.346 +native AdminId:GetUserAdmin(client);
   1.347 +
   1.348 +/**
   1.349 + * Sets access flags on a client.  If the client is not an admin,
   1.350 + * a temporary, anonymous AdminId is given.
   1.351 + *
   1.352 + * @param client		Player's index.
   1.353 + * @param ...			Flags to set on the client.
   1.354 + * @noreturn
   1.355 + * @error				Invalid client index, or client not connected.
   1.356 + */
   1.357 +native AddUserFlags(client, AdminFlag:...);
   1.358 +
   1.359 +/**
   1.360 + * Removes flags from a client.  If the client is not an admin,
   1.361 + * this has no effect.
   1.362 + *
   1.363 + * @param client		Player's index.
   1.364 + * @param ...			Flags to remove from the client.
   1.365 + * @noreturn
   1.366 + * @error				Invalid client index, or client not connected.
   1.367 + */
   1.368 +native RemoveUserFlags(client, AdminFlag:...);
   1.369 +
   1.370 +/** 
   1.371 + * Sets access flags on a client using bits instead of flags.  If the
   1.372 + * client is not an admin, and flags not 0, a temporary, anonymous AdminId is given.
   1.373 + *
   1.374 + * @param client		Player's index.
   1.375 + * @param flags			Bitstring of flags to set on client.
   1.376 + * @noreturn
   1.377 + */
   1.378 +native SetUserFlagBits(client, flags);
   1.379 +
   1.380 +/**
   1.381 + * Returns client access flags.  If the client is not an admin,
   1.382 + * the result is always 0.
   1.383 + * 
   1.384 + * @param client		Player's index.
   1.385 + * @return				Flags
   1.386 + * @error				Invalid client index, or client not connected.
   1.387 + */
   1.388 +native GetUserFlagBits(client);
   1.389 +
   1.390 +/**
   1.391 + * Returns whether a user can target another user.
   1.392 + * This is a helper function for CanAdminTarget.
   1.393 + *
   1.394 + * @param client		Player's index.
   1.395 + * @param target		Target player's index.
   1.396 + * @return				True if target is targettable by the player, false otherwise.
   1.397 + * @error				Invalid or unconnected player indexers.
   1.398 + */
   1.399 +native bool:CanUserTarget(client, target);
   1.400 +
   1.401 +/**
   1.402 + * Runs through the Core-defined admin authorization checks on a player.
   1.403 + * Has no effect if the player is already an admin.
   1.404 + *
   1.405 + * Note: This function is based on the internal cache only.
   1.406 + *
   1.407 + * @param client		Client index.
   1.408 + * @return				True if access was changed, false if it did not.
   1.409 + * @error				Invalid client index or client not in-game AND authorized.
   1.410 + */
   1.411 +native bool:RunAdminCacheChecks(client);
   1.412 +
   1.413 +/**
   1.414 + * Signals that a player has completed post-connection admin checks.
   1.415 + * Has no effect if the player has already had this event signalled.
   1.416 + *
   1.417 + * Note: This must be sent even if no admin id was assigned.
   1.418 + *
   1.419 + * @param client		Client index.
   1.420 + * @noreturn
   1.421 + * @error				Invalid client index or client not in-game AND authorized.
   1.422 + */
   1.423 +native NotifyPostAdminCheck(client);
   1.424 +
   1.425 +/** 
   1.426 + * Creates a fake client.
   1.427 + *
   1.428 + * @param name			Name to use.
   1.429 + * @return				Client index on success, 0 otherwise.
   1.430 + */
   1.431 +native CreateFakeClient(const String:name[]);
   1.432 +
   1.433 +/**
   1.434 + * Sets a convar value on a fake client.
   1.435 + *
   1.436 + * @param client		Client index.
   1.437 + * @param cvar			ConVar name.
   1.438 + * @param value			ConVar value.
   1.439 + * @noreturn
   1.440 + * @error				Invalid client index, client not connected,
   1.441 + *						or client not a fake client.
   1.442 + */
   1.443 +native SetFakeClientConVar(client, const String:cvar[], const String:value[]);
   1.444 +
   1.445 +/**
   1.446 + * Returns the client's health.
   1.447 + *
   1.448 + * @param client		Player's index.
   1.449 + * @return				Health value.
   1.450 + * @error				Invalid client index, client not in game, or no mod support.
   1.451 + */
   1.452 +native GetClientHealth(client);
   1.453 +
   1.454 +/**
   1.455 + * Returns the client's model name.
   1.456 + *
   1.457 + * @param client		Player's index.
   1.458 + * @param model			Buffer to store the client's model name.
   1.459 + * @param maxlen		Maximum length of string buffer (includes NULL terminator).
   1.460 + * @noreturn
   1.461 + * @error				Invalid client index, client not in game, or no mod support.
   1.462 + */
   1.463 +native GetClientModel(client, String:model[], maxlen);
   1.464 +
   1.465 +/**
   1.466 + * Returns the client's weapon name.
   1.467 + *
   1.468 + * @param client		Player's index.
   1.469 + * @param weapon		Buffer to store the client's weapon name.
   1.470 + * @param maxlen		Maximum length of string buffer (includes NULL terminator).
   1.471 + * @noreturn
   1.472 + * @error				Invalid client index, client not in game, or no mod support.
   1.473 + */
   1.474 +native GetClientWeapon(client, String:weapon[], maxlen);
   1.475 +
   1.476 +/**
   1.477 + * Returns the client's max size vector.
   1.478 + *
   1.479 + * @param client		Player's index.
   1.480 + * @param vec			Destination vector to store the client's max size.
   1.481 + * @noreturn
   1.482 + * @error				Invalid client index, client not in game, or no mod support.
   1.483 + */
   1.484 +native GetClientMaxs(client, Float:vec[3]);
   1.485 +
   1.486 +/**
   1.487 + * Returns the client's min size vector.
   1.488 + *
   1.489 + * @param client		Player's index.
   1.490 + * @param vec			Destination vector to store the client's min size.
   1.491 + * @noreturn
   1.492 + * @error				Invalid client index, client not in game, or no mod support.
   1.493 + */
   1.494 +native GetClientMins(client, Float:vec[3]);
   1.495 +
   1.496 +/**
   1.497 + * Returns the client's position angle.
   1.498 + *
   1.499 + * @param client		Player's index.
   1.500 + * @param ang			Destination vector to store the client's position angle.
   1.501 + * @noreturn
   1.502 + * @error				Invalid client index, client not in game, or no mod support.
   1.503 + */
   1.504 +native GetClientAbsAngles(client, Float:ang[3]);
   1.505 +
   1.506 +/**
   1.507 + * Returns the client's origin vector.
   1.508 + *
   1.509 + * @param client		Player's index.
   1.510 + * @param vec			Destination vector to store the client's origin vector.
   1.511 + * @noreturn
   1.512 + * @error				Invalid client index, client not in game, or no mod support.
   1.513 + */
   1.514 +native GetClientAbsOrigin(client, Float:vec[3]);
   1.515 +
   1.516 +/**
   1.517 + * Returns the client's armor.
   1.518 + *
   1.519 + * @param client		Player's index.
   1.520 + * @return				Armor value.
   1.521 + * @error				Invalid client index, client not in game, or no mod support.
   1.522 + */
   1.523 +native GetClientArmor(client);
   1.524 +
   1.525 +/**
   1.526 + * Returns the client's death count.
   1.527 + *
   1.528 + * @param client		Player's index.
   1.529 + * @return				Death count.
   1.530 + * @error				Invalid client index, client not in game, or no mod support.
   1.531 + */
   1.532 +native GetClientDeaths(client);
   1.533 +
   1.534 +/**
   1.535 + * Returns the client's frag count.
   1.536 + *
   1.537 + * @param client		Player's index.
   1.538 + * @return				Frag count.
   1.539 + * @error				Invalid client index, client not in game, or no mod support.
   1.540 + */
   1.541 +native GetClientFrags(client);
   1.542 +
   1.543 +/**
   1.544 + * Returns the client's send data rate in bytes/sec.
   1.545 + *
   1.546 + * @param client		Player's index.
   1.547 + * @return				Data rate.
   1.548 + * @error				Invalid client index, client not in game, or fake client.
   1.549 + */
   1.550 +native GetClientDataRate(client);
   1.551 +
   1.552 +/**
   1.553 + * Returns if a client is timing out
   1.554 + *
   1.555 + * @param client		Player's index.
   1.556 + * @return				True if client is timing out, false otherwise.
   1.557 + * @error				Invalid client index, client not in game, or fake client.
   1.558 + */
   1.559 +native bool:IsClientTimingOut(client);
   1.560 +
   1.561 +/**
   1.562 + * Returns the client's connection time in seconds.
   1.563 + *
   1.564 + * @param client		Player's index.
   1.565 + * @return				Connection time.
   1.566 + * @error				Invalid client index, client not in game, or fake client.
   1.567 + */
   1.568 +native Float:GetClientTime(client);
   1.569 +
   1.570 +/**
   1.571 + * Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
   1.572 + *
   1.573 + * @param client		Player's index.
   1.574 + * @param flow			Traffic flowing direction.
   1.575 + * @return				Latency.
   1.576 + * @error				Invalid client index, client not in game, or fake client.
   1.577 + */
   1.578 +native Float:GetClientLatency(client, NetFlow:flow);
   1.579 +
   1.580 +/**
   1.581 + * Returns the client's average packet latency in seconds.
   1.582 + *
   1.583 + * @param client		Player's index.
   1.584 + * @param flow			Traffic flowing direction.
   1.585 + * @return				Average latency.
   1.586 + * @error				Invalid client index, client not in game, or fake client.
   1.587 + */
   1.588 +native Float:GetClientAvgLatency(client, NetFlow:flow);
   1.589 +
   1.590 +/**
   1.591 + * Returns the client's average packet loss, values go from 0 to 1 (for percentages).
   1.592 + *
   1.593 + * @param client		Player's index.
   1.594 + * @param flow			Traffic flowing direction.
   1.595 + * @return				Average packet loss.
   1.596 + * @error				Invalid client index, client not in game, or fake client.
   1.597 + */
   1.598 +native Float:GetClientAvgLoss(client, NetFlow:flow);
   1.599 +
   1.600 +/**
   1.601 + * Returns the client's average packet choke, values go from 0 to 1 (for percentages).
   1.602 + *
   1.603 + * @param client		Player's index.
   1.604 + * @param flow			Traffic flowing direction.
   1.605 + * @return				Average packet choke.
   1.606 + * @error				Invalid client index, client not in game, or fake client.
   1.607 + */
   1.608 +native Float:GetClientAvgChoke(client, NetFlow:flow);
   1.609 +
   1.610 +/**
   1.611 + * Returns the client's data flow in bytes/sec.
   1.612 + *
   1.613 + * @param client		Player's index.
   1.614 + * @param flow			Traffic flowing direction.
   1.615 + * @return				Data flow.
   1.616 + * @error				Invalid client index, client not in game, or fake client.
   1.617 + */
   1.618 +native Float:GetClientAvgData(client, NetFlow:flow);
   1.619 +
   1.620 +/**
   1.621 + * Returns the client's average packet frequency in packets/sec.
   1.622 + *
   1.623 + * @param client		Player's index.
   1.624 + * @param flow			Traffic flowing direction.
   1.625 + * @return				Packet frequency.
   1.626 + * @error				Invalid client index, client not in game, or fake client.
   1.627 + */
   1.628 +native Float:GetClientAvgPackets(client, NetFlow:flow);
   1.629 +
   1.630 +/**
   1.631 + * Translates an userid index to the real player index.
   1.632 + *
   1.633 + * @param userid		Userid value.
   1.634 + * @return				Client value.
   1.635 + * @error				Returns 0 if invalid userid.
   1.636 + */
   1.637 +native GetClientOfUserId(userid);
   1.638 +
   1.639 +/**
   1.640 + * Disconnects a client from the server as soon as the next frame starts.
   1.641 + *
   1.642 + * Note: Originally, KickClient() was immediate.  The delay was introduced 
   1.643 + * because despite warnings, plugins were using it in ways that would crash. 
   1.644 + * The new safe version can break cases that rely on immediate disconnects, 
   1.645 + * but ensures that plugins do not accidentally cause crashes.
   1.646 + *
   1.647 + * If you need immediate disconnects, use KickClientEx().
   1.648 + *
   1.649 + * Note: IsClientInKickQueue() will return true before the kick occurs.
   1.650 + *
   1.651 + * @param client		Client index.
   1.652 + * @param format		Optional formatting rules for disconnect reason.
   1.653 + *                      Note that a period is automatically appended to the string by the engine.
   1.654 + * @param ...			Variable number of format parameters.
   1.655 + * @noreturn
   1.656 + * @error				Invalid client index, or client not connected.
   1.657 + */
   1.658 +native KickClient(client, const String:format[]="", any:...);
   1.659 +
   1.660 +/**
   1.661 + * Immediately disconnects a client from the server.
   1.662 + *
   1.663 + * Kicking clients from certain events or callbacks may cause crashes.  If in 
   1.664 + * doubt, create a short (0.1 second) timer to kick the client in the next 
   1.665 + * available frame.
   1.666 + *
   1.667 + * @param client		Client index.
   1.668 + * @param format		Optional formatting rules for disconnect reason.
   1.669 + *                      Note that a period is automatically appended to the string by the engine.
   1.670 + * @param ...			Variable number of format parameters.
   1.671 + * @noreturn
   1.672 + * @error				Invalid client index, or client not connected.
   1.673 + */
   1.674 +native KickClientEx(client, const String:format[]="", any:...);
   1.675 +
   1.676 +/**
   1.677 + * Changes a client's team through the mod's generic team changing function.
   1.678 + * On CS:S, this will kill the player.
   1.679 + *
   1.680 + * @param client		Client index.
   1.681 + * @param team			Mod-specific team index.
   1.682 + * @noreturn
   1.683 + * @error				Invalid client index, client not connected, or lack of 
   1.684 + *						mod support.
   1.685 + */
   1.686 +native ChangeClientTeam(client, team);
   1.687 +