Enumerations2
SymbolDescription
AuthIdTypeAuth 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.
NetFlowNetwork flow directions.
Defines3
SymbolDescription
MAX_AUTHID_LENGTHMaximum buffer required to store any AuthID type
MAX_NAME_LENGTHMaximum buffer required to store a client name
MAXPLAYERSMaximum number of players SourceMod supports
Forwards16
SymbolDescription
OnClientAuthorizedCalled after a client's auth ID has been validated. The state of a client's authorization as an admin is not guaranteed here. Use OnClientPostAdminCheck() if you need a client's admin status. There may be a delay in receiving this callback if the Steam netowrk is experience downtime or other issues. This is called by bots, but the ID will be "BOT".
OnClientCommandCalled when a client is sending a command. As of SourceMod 1.3, the client is guaranteed to be in-game. Use command listeners (console.inc) for more advanced hooks.
OnClientCommandKeyValuesCalled when a client is sending a KeyValues command.
OnClientCommandKeyValues_PostCalled after a client has sent a KeyValues command.
OnClientConnectCalled 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. 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.
OnClientConnectedCalled once a client successfully connects. This callback is paired with OnClientDisconnect.
OnClientDisconnectCalled when a client is disconnecting from the server.
OnClientDisconnect_PostCalled when a client is disconnected from the server.
OnClientLanguageChangedCalled when the language was received from the player.
OnClientPostAdminCheckCalled once a client is authorized and fully in-game, and after all post-connection authorizations have been performed. This callback is guaranteed to occur on all clients, and always after each OnClientPutInServer() call.
OnClientPostAdminFilterCalled 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.
OnClientPreAdminCheckCalled 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(). This callback is guaranteed to occur on all clients, and always after each OnClientPutInServer() call.
OnClientPutInServerCalled 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.
OnClientSettingsChangedCalled whenever the client's settings are changed.
OnServerEnterHibernationCalled directly before the server enters hibernation. This is your last chance to do anything in the plugin before hibernation occurs, as SV_Frame will no longer be called.
OnServerExitHibernationCalled directly before the server leaves hibernation.
Functions57
SymbolDescription
AddUserFlagsSets access flags on a client. If the client is not an admin, a temporary, anonymous AdminId is given.
CanUserTargetReturns whether a user can target another user. This is a helper function for CanAdminTarget.
ChangeClientTeamChanges a client's team through the mod's generic team changing function. On CS:S, this will kill the player.
CreateFakeClientCreates a fake client.
GetClientAbsAnglesReturns the client's position angle.
GetClientAbsOriginReturns the client's origin vector.
GetClientArmorReturns the client's armor.
GetClientAuthIdRetrieves a client's authentication string (SteamID).
GetClientAuthString
GetClientAvgChokeReturns the client's average packet choke, values go from 0 to 1 (for percentages).
GetClientAvgDataReturns the client's data flow in bytes/sec.
GetClientAvgLatencyReturns the client's average packet latency in seconds.
GetClientAvgLossReturns the client's average packet loss, values go from 0 to 1 (for percentages).
GetClientAvgPacketsReturns the client's average packet frequency in packets/sec.
GetClientCountReturns the client count put in the server.
GetClientDataRateReturns the client's send data rate in bytes/sec.
GetClientDeathsReturns the client's death count.
GetClientFragsReturns the client's frag count.
GetClientFromSerialReturns the client index by its serial number.
GetClientHealthReturns the client's health.
GetClientInfoRetrieves values from client replicated keys.
GetClientIPRetrieves a client's IP address.
GetClientLatencyReturns the client's current latency (RTT), more accurate than GetAvgLatency but jittering.
GetClientMaxsReturns the client's max size vector.
GetClientMinsReturns the client's min size vector.
GetClientModelReturns the client's model name.
GetClientNameReturns the client's name.
GetClientOfUserIdTranslates an userid index to the real player index.
GetClientSerialReturns the clients unique serial identifier.
GetClientTeamRetrieves a client's team index.
GetClientTimeReturns the client's connection time in seconds.
GetClientUserIdRetrieves a client's user id, which is an index incremented for every client that joins the server.
GetClientWeaponReturns the client's weapon name.
GetMaxClients
GetMaxHumanPlayersReturns 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.
GetSteamAccountIDReturns 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.
GetUserAdminRetrieves a client's AdminId.
GetUserFlagBitsReturns client access flags. If the client is not an admin, the result is always 0.
IsClientAuthorizedReturns if a certain player has been authenticated.
IsClientConnectedReturns if a certain player is connected.
IsClientInGameReturns if a certain player has entered the game.
IsClientInKickQueueReturns if a client is in the "kick queue" (i.e. the client will be kicked shortly and thus they should not appear as valid).
IsClientObserverReturns if a certain player is an observer/spectator.
IsClientReplayReturns if a certain player is the Replay bot.
IsClientSourceTVReturns if a certain player is the SourceTV bot.
IsClientTimingOutReturns if a client is timing out
IsFakeClientReturns if a certain player is a fake client.
IsPlayerAliveReturns if the client is alive or dead. Note: This function was originally in SDKTools and was moved to core.
IsPlayerInGame
KickClientDisconnects 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.
KickClientExImmediately 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.
NotifyPostAdminCheckSignals 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.
RemoveUserFlagsRemoves flags from a client. If the client is not an admin, this has no effect.
RunAdminCacheChecksRuns 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.
SetFakeClientConVarSets a convar value on a fake client.
SetUserAdminSets a client's AdminId.
SetUserFlagBitsSets 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.