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