2008-10-04 22:59:11 +02:00
|
|
|
/**
|
|
|
|
* vim: set ts=4 :
|
|
|
|
* =============================================================================
|
|
|
|
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
|
|
|
|
* =============================================================================
|
|
|
|
*
|
|
|
|
* This file is part of the SourceMod/SourcePawn SDK.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License, version 3.0, as published by the
|
|
|
|
* Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
* details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with
|
|
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
|
|
|
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
|
|
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
|
|
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
|
|
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
|
|
|
* this exception to all derivative works. AlliedModders LLC defines further
|
|
|
|
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
|
|
|
|
* or <http://www.sourcemod.net/license.php>.
|
|
|
|
*
|
2009-04-14 23:40:48 +02:00
|
|
|
* Version: $Id$
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined _clients_included
|
|
|
|
#endinput
|
|
|
|
#endif
|
|
|
|
#define _clients_included
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Network flow directions.
|
|
|
|
*/
|
|
|
|
enum NetFlow
|
|
|
|
{
|
2019-09-27 13:14:44 +02:00
|
|
|
NetFlow_Outgoing = 0, /**< Outgoing traffic */
|
|
|
|
NetFlow_Incoming, /**< Incoming traffic */
|
|
|
|
NetFlow_Both /**< Both values added together */
|
2008-10-04 22:59:11 +02:00
|
|
|
};
|
|
|
|
|
2015-03-21 15:43:24 +01:00
|
|
|
/**
|
|
|
|
* Auth string types.
|
|
|
|
*
|
|
|
|
* Note that for the Steam2 and Steam3 types, the following ids are
|
|
|
|
* also valid values:
|
|
|
|
* "STEAM_ID_PENDING" - Authentication is pending.
|
|
|
|
* "STEAM_ID_LAN" - Authentication is disabled because of being on a LAN server.
|
|
|
|
* "BOT" - The client is a bot.
|
|
|
|
*/
|
|
|
|
enum AuthIdType
|
|
|
|
{
|
|
|
|
AuthId_Engine = 0, /**< The game-specific auth string as returned from the engine */
|
|
|
|
|
|
|
|
// The following are only available on games that support Steam authentication.
|
|
|
|
AuthId_Steam2, /**< Steam2 rendered format, ex "STEAM_1:1:4153990" */
|
|
|
|
AuthId_Steam3, /**< Steam3 rendered format, ex "[U:1:8307981]" */
|
2019-09-27 13:14:44 +02:00
|
|
|
AuthId_SteamID64 /**< A SteamID64 (uint64) as a String, ex "76561197968573709" */
|
2015-03-21 15:43:24 +01:00
|
|
|
};
|
|
|
|
|
2009-04-14 23:40:48 +02:00
|
|
|
/**
|
|
|
|
* MAXPLAYERS is not the same as MaxClients.
|
|
|
|
* MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
|
|
|
|
*/
|
|
|
|
|
2019-09-27 13:14:44 +02:00
|
|
|
#define MAXPLAYERS 65 /**< Maximum number of players SourceMod supports */
|
|
|
|
#define MAX_NAME_LENGTH 128 /**< Maximum buffer required to store a client name */
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2019-09-27 13:14:44 +02:00
|
|
|
public const int MaxClients; /**< Maximum number of players the server supports (dynamic) */
|
2009-04-14 23:40:48 +02:00
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
/**
|
2009-04-14 23:40:48 +02:00
|
|
|
* Called on client connection. If you return true, the client will be allowed in the server.
|
|
|
|
* If you return false (or return nothing), the client will be rejected. If the client is
|
|
|
|
* rejected by this forward or any other, OnClientDisconnect will not be called.
|
2008-10-04 22:59:11 +02:00
|
|
|
*
|
2009-07-16 10:16:58 +02:00
|
|
|
* Note: Do not write to rejectmsg if you plan on returning true. If multiple plugins write
|
|
|
|
* to the string buffer, it is not defined which plugin's string will be shown to the client,
|
|
|
|
* but it is guaranteed one of them will.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param rejectmsg Buffer to store the rejection message when the connection is refused.
|
|
|
|
* @param maxlen Maximum number of characters for rejection buffer.
|
|
|
|
* @return True to validate client's connection, false to refuse it.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward bool OnClientConnect(int client, char[] rejectmsg, int maxlen);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2009-04-14 23:40:48 +02:00
|
|
|
/**
|
|
|
|
* Called once a client successfully connects. This callback is paired with OnClientDisconnect.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2009-04-14 23:40:48 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientConnected(int client);
|
2009-04-14 23:40:48 +02:00
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
/**
|
|
|
|
* Called when a client is entering the game.
|
|
|
|
*
|
|
|
|
* Whether a client has a steamid is undefined until OnClientAuthorized
|
|
|
|
* is called, which may occur either before or after OnClientPutInServer.
|
|
|
|
* Similarly, use OnClientPostAdminCheck() if you need to verify whether
|
|
|
|
* connecting players are admins.
|
|
|
|
*
|
|
|
|
* GetClientCount() will include clients as they are passed through this
|
|
|
|
* function, as clients are already in game at this point.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientPutInServer(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is disconnecting from the server.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientDisconnect(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is disconnected from the server.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientDisconnect_Post(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is sending a command.
|
|
|
|
*
|
2010-07-25 20:58:18 +02:00
|
|
|
* As of SourceMod 1.3, the client is guaranteed to be in-game.
|
|
|
|
* Use command listeners (console.inc) for more advanced hooks.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param args Number of arguments.
|
|
|
|
* @return Plugin_Handled blocks the command from being sent,
|
|
|
|
* and Plugin_Continue resumes normal functionality.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward Action OnClientCommand(int client, int args);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when a client is sending a KeyValues command.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param kv Editable KeyValues data to be sent as the command.
|
|
|
|
* (This handle should not be stored and will be closed
|
|
|
|
* after this forward completes.)
|
|
|
|
* @return Plugin_Handled blocks the command from being sent,
|
|
|
|
* and Plugin_Continue resumes normal functionality.
|
2016-08-23 15:34:00 +02:00
|
|
|
*/
|
|
|
|
forward Action OnClientCommandKeyValues(int client, KeyValues kv);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called after a client has sent a KeyValues command.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param kv KeyValues data sent as the command.
|
|
|
|
* (This handle should not be stored and will be closed
|
|
|
|
* after this forward completes.)
|
2016-08-23 15:34:00 +02:00
|
|
|
*/
|
|
|
|
forward void OnClientCommandKeyValues_Post(int client, KeyValues kv);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called whenever the client's settings are changed.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientSettingsChanged(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
2015-03-21 15:43:24 +01:00
|
|
|
* Called when a client receives an auth ID. The state of a client's
|
2010-07-25 20:58:18 +02:00
|
|
|
* authorization as an admin is not guaranteed here. Use
|
|
|
|
* OnClientPostAdminCheck() if you need a client's admin status.
|
2008-10-04 22:59:11 +02:00
|
|
|
*
|
|
|
|
* This is called by bots, but the ID will be "BOT".
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param auth Client Steam2 id, if available, else engine auth id.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientAuthorized(int client, const char[] auth);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once a client is authorized and fully in-game, but
|
|
|
|
* before admin checks are done. This can be used to override
|
|
|
|
* the default admin checks for a client. You should only use
|
|
|
|
* this for overriding; use OnClientPostAdminCheck() instead
|
|
|
|
* if you want notification.
|
|
|
|
*
|
|
|
|
* Note: If handled/blocked, PostAdminCheck must be signalled
|
|
|
|
* manually via NotifyPostAdminCheck().
|
|
|
|
*
|
2016-08-23 15:34:00 +02:00
|
|
|
* This callback is guaranteed to occur on all clients, and always
|
2008-10-04 22:59:11 +02:00
|
|
|
* after each OnClientPutInServer() call.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @return Plugin_Handled to block admin checks.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward Action OnClientPreAdminCheck(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called directly before OnClientPostAdminCheck() as a method to
|
|
|
|
* alter administrative permissions before plugins perform final
|
|
|
|
* post-connect operations.
|
|
|
|
*
|
|
|
|
* In general, do not use this function unless you are specifically
|
|
|
|
* attempting to change access permissions. Use OnClientPostAdminCheck()
|
|
|
|
* instead if you simply want to perform post-connect authorization
|
|
|
|
* routines.
|
|
|
|
*
|
|
|
|
* See OnClientPostAdminCheck() for more information.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientPostAdminFilter(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Called once a client is authorized and fully in-game, and
|
|
|
|
* after all post-connection authorizations have been performed.
|
|
|
|
*
|
2016-08-23 15:34:00 +02:00
|
|
|
* This callback is guaranteed to occur on all clients, and always
|
2008-10-04 22:59:11 +02:00
|
|
|
* after each OnClientPutInServer() call.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
forward void OnClientPostAdminCheck(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* This function is deprecated. Use the MaxClients variable instead.
|
2009-04-14 23:40:48 +02:00
|
|
|
*
|
2008-10-04 22:59:11 +02:00
|
|
|
* Returns the maximum number of clients allowed on the server. This may
|
|
|
|
* return 0 if called before OnMapStart(), and thus should not be called
|
|
|
|
* in OnPluginStart().
|
|
|
|
*
|
2009-04-14 23:40:48 +02:00
|
|
|
* You should not globally cache the value to GetMaxClients() because it can change from
|
|
|
|
* SourceTV or TF2's arena mode. Use the "MaxClients" dynamic variable documented at the
|
|
|
|
* top of this file.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @return Maximum number of clients allowed.
|
|
|
|
* @deprecated Use MaxClients variable instead.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2019-09-27 13:14:44 +02:00
|
|
|
#pragma deprecated Use MaxClients variable instead.
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetMaxClients();
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
/**
|
|
|
|
* Returns the maximum number of human players allowed on the server. This is
|
|
|
|
* a game-specific function used on newer games to limit the number of humans
|
|
|
|
* that can join a game and can be lower than MaxClients. It is the number often
|
|
|
|
* reflected in the server browser or when viewing the output of the status command.
|
|
|
|
* On unsupported games or modes without overrides, it will return the same value
|
|
|
|
* as MaxClients.
|
|
|
|
*
|
|
|
|
* You should not globally cache the value to GetMaxHumanPlayers() because it can change across
|
|
|
|
* game modes. You may still cache it locally.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @return Maximum number of humans allowed.
|
2014-07-30 11:03:42 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetMaxHumanPlayers();
|
2014-07-30 11:03:42 +02:00
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
/**
|
|
|
|
* Returns the client count put in the server.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param inGameOnly If false connecting players are also counted.
|
|
|
|
* @return Client count in the server.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientCount(bool inGameOnly=true);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's name.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @param name Buffer to store the client's name.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @return True on success, false otherwise.
|
|
|
|
* @error If the client is not connected an error will be thrown.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool GetClientName(int client, char[] name, int maxlen);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a client's IP address.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @param ip Buffer to store the client's ip address.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @param remport Remove client's port from the ip string (true by default).
|
|
|
|
* @return True on success, false otherwise.
|
|
|
|
* @error If the client is not connected or the index is invalid.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool GetClientIP(int client, char[] ip, int maxlen, bool remport=true);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a client's authentication string (SteamID).
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @param auth Buffer to store the client's auth string.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @param validate Check backend validation status.
|
|
|
|
* DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
|
|
|
|
* You WILL KNOW if you need to use this, MOST WILL NOT.
|
|
|
|
* @return True on success, false otherwise.
|
|
|
|
* @error If the client is not connected or the index is invalid.
|
|
|
|
* @deprecated Use GetClientAuthId
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2015-03-21 15:43:24 +01:00
|
|
|
#pragma deprecated Use GetClientAuthId
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool GetClientAuthString(int client, char[] auth, int maxlen, bool validate=true);
|
2014-07-30 11:03:42 +02:00
|
|
|
|
2015-03-21 15:43:24 +01:00
|
|
|
/**
|
|
|
|
* Retrieves a client's authentication string (SteamID).
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @param authType Auth id type and format to use.
|
|
|
|
* @param auth Buffer to store the client's auth id.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @param validate Check backend validation status.
|
|
|
|
* DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
|
|
|
|
* You WILL KNOW if you need to use this, MOST WILL NOT.
|
|
|
|
* @return True on success, false otherwise.
|
|
|
|
* @error If the client is not connected or the index is invalid.
|
2015-03-21 15:43:24 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool GetClientAuthId(int client, AuthIdType authType, char[] auth, int maxlen, bool validate=true);
|
2015-03-21 15:43:24 +01:00
|
|
|
|
2014-07-30 11:03:42 +02:00
|
|
|
/**
|
2019-09-27 13:14:44 +02:00
|
|
|
* Returns the client's Steam account ID, a number uniquely identifying a given Steam account.
|
|
|
|
* This number is the basis for the various display SteamID forms, see the AuthIdType enum for examples.
|
2014-07-30 11:03:42 +02:00
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client Index.
|
|
|
|
* @param validate Check backend validation status.
|
|
|
|
* DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
|
|
|
|
* You WILL KNOW if you need to use this, MOST WILL NOT.
|
|
|
|
* @return Steam account ID or 0 if not available.
|
|
|
|
* @error If the client is not connected or the index is invalid.
|
2014-07-30 11:03:42 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetSteamAccountID(int client, bool validate=true);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a client's user id, which is an index incremented for every client
|
|
|
|
* that joins the server.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return User id of the client.
|
|
|
|
* @error If the client is not connected or the index is invalid.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientUserId(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player is connected.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is connected to the server, false otherwise.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientConnected(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player has entered the game.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index (index does not have to be connected).
|
|
|
|
* @return True if player has entered the game, false otherwise.
|
|
|
|
* @error Invalid client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientInGame(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a client is in the "kick queue" (i.e. the client will be kicked
|
|
|
|
* shortly and thus they should not appear as valid).
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index (must be connected).
|
|
|
|
* @return True if in the kick queue, false otherwise.
|
|
|
|
* @error Invalid client index.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientInKickQueue(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Backwards compatibility stock - use IsClientInGame
|
2019-09-27 13:14:44 +02:00
|
|
|
* @deprecated Renamed to IsClientInGame
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
|
|
|
#pragma deprecated Use IsClientInGame() instead
|
2016-08-23 15:34:00 +02:00
|
|
|
stock bool IsPlayerInGame(int client)
|
2008-10-04 22:59:11 +02:00
|
|
|
{
|
|
|
|
return IsClientInGame(client);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player has been authenticated.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player has been authenticated, false otherwise.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientAuthorized(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player is a fake client.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is a fake client, false otherwise.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsFakeClient(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2012-01-28 02:16:49 +01:00
|
|
|
/**
|
|
|
|
* Returns if a certain player is the SourceTV bot.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is the SourceTV bot, false otherwise.
|
2012-01-28 02:16:49 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientSourceTV(int client);
|
2012-01-28 02:16:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a certain player is the Replay bot.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is the Replay bot, false otherwise.
|
2012-01-28 02:16:49 +01:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientReplay(int client);
|
2012-01-28 02:16:49 +01:00
|
|
|
|
2008-10-04 22:59:11 +02:00
|
|
|
/**
|
|
|
|
* Returns if a certain player is an observer/spectator.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player index.
|
|
|
|
* @return True if player is an observer, false otherwise.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientObserver(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if the client is alive or dead.
|
|
|
|
*
|
|
|
|
* Note: This function was originally in SDKTools and was moved to core.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return True if the client is alive, false otherwise.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsPlayerAlive(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves values from client replicated keys.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param key Key string.
|
|
|
|
* @param value Buffer to store value.
|
|
|
|
* @param maxlen Maximum length of valve (UTF-8 safe).
|
|
|
|
* @return True on success, false otherwise.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool GetClientInfo(int client, const char[] key, char[] value, int maxlen);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a client's team index.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Team index the client is on (mod specific).
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientTeam(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a client's AdminId.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param id AdminId to set. INVALID_ADMIN_ID removes admin permissions.
|
|
|
|
* @param temp True if the id should be freed on disconnect.
|
|
|
|
* @error Invalid client index, client not connected, or bogus AdminId.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SetUserAdmin(int client, AdminId id, bool temp=false);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves a client's AdminId.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return AdminId of the client, or INVALID_ADMIN_ID if none.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native AdminId GetUserAdmin(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets access flags on a client. If the client is not an admin,
|
|
|
|
* a temporary, anonymous AdminId is given.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param ... Flags to set on the client.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void AddUserFlags(int client, AdminFlag ...);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes flags from a client. If the client is not an admin,
|
|
|
|
* this has no effect.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param ... Flags to remove from the client.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void RemoveUserFlags(int client, AdminFlag ...);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets access flags on a client using bits instead of flags. If the
|
|
|
|
* client is not an admin, and flags not 0, a temporary, anonymous AdminId is given.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flags Bitstring of flags to set on client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SetUserFlagBits(int client, int flags);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns client access flags. If the client is not an admin,
|
|
|
|
* the result is always 0.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Flags
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetUserFlagBits(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether a user can target another user.
|
|
|
|
* This is a helper function for CanAdminTarget.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param target Target player's index.
|
|
|
|
* @return True if target is targettable by the player, false otherwise.
|
|
|
|
* @error Invalid or unconnected player indexers.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool CanUserTarget(int client, int target);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Runs through the Core-defined admin authorization checks on a player.
|
|
|
|
* Has no effect if the player is already an admin.
|
|
|
|
*
|
|
|
|
* Note: This function is based on the internal cache only.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @return True if access was changed, false if it did not.
|
|
|
|
* @error Invalid client index or client not in-game AND authorized.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool RunAdminCacheChecks(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a player has completed post-connection admin checks.
|
|
|
|
* Has no effect if the player has already had this event signalled.
|
|
|
|
*
|
|
|
|
* Note: This must be sent even if no admin id was assigned.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @error Invalid client index or client not in-game AND authorized.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void NotifyPostAdminCheck(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a fake client.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param name Name to use.
|
|
|
|
* @return Client index on success, 0 otherwise.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int CreateFakeClient(const char[] name);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets a convar value on a fake client.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param cvar ConVar name.
|
|
|
|
* @param value ConVar value.
|
|
|
|
* @error Invalid client index, client not connected,
|
|
|
|
* or client not a fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void SetFakeClientConVar(int client, const char[] cvar, const char[] value);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's health.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Health value.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientHealth(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's model name.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param model Buffer to store the client's model name.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientModel(int client, char[] model, int maxlen);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's weapon name.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param weapon Buffer to store the client's weapon name.
|
|
|
|
* @param maxlen Maximum length of string buffer (includes NULL terminator).
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientWeapon(int client, char[] weapon, int maxlen);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's max size vector.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param vec Destination vector to store the client's max size.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientMaxs(int client, float vec[3]);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's min size vector.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param vec Destination vector to store the client's min size.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientMins(int client, float vec[3]);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's position angle.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param ang Destination vector to store the client's position angle.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientAbsAngles(int client, float ang[3]);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's origin vector.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param vec Destination vector to store the client's origin vector.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void GetClientAbsOrigin(int client, float vec[3]);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's armor.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Armor value.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientArmor(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's death count.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Death count.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientDeaths(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's frag count.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Frag count.
|
|
|
|
* @error Invalid client index, client not in game, or no mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientFrags(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's send data rate in bytes/sec.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Data rate.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientDataRate(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns if a client is timing out
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return True if client is timing out, false otherwise.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native bool IsClientTimingOut(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's connection time in seconds.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @return Connection time.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientTime(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Latency, or -1 if network info is not available.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientLatency(int client, NetFlow flow);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's average packet latency in seconds.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Latency, or -1 if network info is not available.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientAvgLatency(int client, NetFlow flow);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's average packet loss, values go from 0 to 1 (for percentages).
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Average packet loss, or -1 if network info is not available.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientAvgLoss(int client, NetFlow flow);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's average packet choke, values go from 0 to 1 (for percentages).
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Average packet loss, or -1 if network info is not available.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientAvgChoke(int client, NetFlow flow);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's data flow in bytes/sec.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Data flow.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native float GetClientAvgData(int client, NetFlow flow);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's average packet frequency in packets/sec.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Player's index.
|
|
|
|
* @param flow Traffic flowing direction.
|
|
|
|
* @return Packet frequency.
|
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
|
|
|
*/
|
|
|
|
native float GetClientAvgPackets(int client, NetFlow flow);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client's baseserver IClient pointer.
|
|
|
|
*
|
2008-10-04 22:59:11 +02:00
|
|
|
* @param client Player's index.
|
2019-09-27 13:14:44 +02:00
|
|
|
* @return IClient address.
|
2014-07-30 11:03:42 +02:00
|
|
|
* @error Invalid client index, client not connected, or fake client.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2019-09-27 13:14:44 +02:00
|
|
|
native Address GetClientIClient(int client);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translates an userid index to the real player index.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param userid Userid value.
|
|
|
|
* @return Client value.
|
|
|
|
* @error Returns 0 if invalid userid.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientOfUserId(int userid);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Disconnects a client from the server as soon as the next frame starts.
|
|
|
|
*
|
|
|
|
* Note: Originally, KickClient() was immediate. The delay was introduced
|
|
|
|
* because despite warnings, plugins were using it in ways that would crash.
|
|
|
|
* The new safe version can break cases that rely on immediate disconnects,
|
|
|
|
* but ensures that plugins do not accidentally cause crashes.
|
|
|
|
*
|
|
|
|
* If you need immediate disconnects, use KickClientEx().
|
|
|
|
*
|
|
|
|
* Note: IsClientInKickQueue() will return true before the kick occurs.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param format Optional formatting rules for disconnect reason.
|
2008-10-04 22:59:11 +02:00
|
|
|
* Note that a period is automatically appended to the string by the engine.
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param ... Variable number of format parameters.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void KickClient(int client, const char[] format="", any ...);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Immediately disconnects a client from the server.
|
|
|
|
*
|
|
|
|
* Kicking clients from certain events or callbacks may cause crashes. If in
|
|
|
|
* doubt, create a short (0.1 second) timer to kick the client in the next
|
|
|
|
* available frame.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param format Optional formatting rules for disconnect reason.
|
2008-10-04 22:59:11 +02:00
|
|
|
* Note that a period is automatically appended to the string by the engine.
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param ... Variable number of format parameters.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void KickClientEx(int client, const char[] format="", any ...);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Changes a client's team through the mod's generic team changing function.
|
|
|
|
* On CS:S, this will kill the player.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @param team Mod-specific team index.
|
|
|
|
* @error Invalid client index, client not connected, or lack of
|
|
|
|
* mod support.
|
2008-10-04 22:59:11 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native void ChangeClientTeam(int client, int team);
|
2008-10-04 22:59:11 +02:00
|
|
|
|
2009-04-14 23:40:48 +02:00
|
|
|
/**
|
|
|
|
* Returns the clients unique serial identifier.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param client Client index.
|
|
|
|
* @return Serial number.
|
|
|
|
* @error Invalid client index, or client not connected.
|
2009-04-14 23:40:48 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientSerial(int client);
|
2009-04-14 23:40:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the client index by its serial number.
|
|
|
|
*
|
2019-09-27 13:14:44 +02:00
|
|
|
* @param serial Serial number.
|
|
|
|
* @return Client index, or 0 for invalid serial.
|
2009-04-14 23:40:48 +02:00
|
|
|
*/
|
2016-08-23 15:34:00 +02:00
|
|
|
native int GetClientFromSerial(int serial);
|