SourceMod SDK  1.7
SourceMod::IGamePlayer Class Referenceabstract

Abstracts some Half-Life 2 and SourceMod properties about clients. More...

#include <public/IPlayerHelpers.h>

Public Member Functions

virtual const char * GetName ()=0
 Returns the player's name. More...
 
virtual const char * GetIPAddress ()=0
 Returns the player's IP address. More...
 
virtual const char * GetAuthString (bool validated=true)=0
 Returns the player's authentication string. More...
 
virtual edict_t * GetEdict ()=0
 Returns the player's edict_t structure. More...
 
virtual bool IsInGame ()=0
 Returns whether the player is in game (putinserver). More...
 
virtual bool IsConnected ()=0
 Returns whether the player is connected. More...
 
virtual bool IsFakeClient ()=0
 Returns whether the player is a fake client. More...
 
virtual AdminId GetAdminId ()=0
 Returns the client's AdminId, if any. More...
 
virtual void SetAdminId (AdminId id, bool temp)=0
 Sets the client's AdminId. More...
 
virtual int GetUserId ()=0
 Returns the client's userid. More...
 
virtual unsigned int GetLanguageId ()=0
 Returns the client's language id. More...
 
virtual IPlayerInfo * GetPlayerInfo ()=0
 Returns a player's IPlayerInfo object, if any. More...
 
virtual bool RunAdminCacheChecks ()=0
 Runs through Core's admin authorization checks. If the client is already an admin, no checks are performed. More...
 
virtual void NotifyPostAdminChecks ()=0
 Notifies all listeners that the client has completed all of your post-connection (in-game, auth, admin) checks. More...
 
virtual unsigned int GetSerial ()=0
 Returns the clients unique serial identifier. More...
 
virtual bool IsAuthorized ()=0
 Return whether the client is authorized. More...
 
virtual void Kick (const char *message)=0
 Kicks the client with a message. More...
 
virtual bool IsInKickQueue ()=0
 Returns whether the client is marked as being in the kick queue. The client doesn't necessarily have to be in the actual kick queue for this function to return true. More...
 
virtual void MarkAsBeingKicked ()=0
 Marks the client as being in the kick queue. They are not actually added to the kick queue. Use IGameHelpers::AddDelayedKick() to actually add them to the queue.
 
virtual void SetLanguageId (unsigned int id)=0
 
virtual bool IsSourceTV () const =0
 Returns whether the player is the SourceTV bot. More...
 
virtual bool IsReplay () const =0
 Returns whether the player is the Replay bot. More...
 
virtual unsigned int GetSteamAccountID (bool validated=true)=0
 Returns the client's Steam account ID. More...
 
virtual int GetIndex () const =0
 Returns the client's edict/entity index. More...
 
virtual void PrintToConsole (const char *pMsg)=0
 Prints a string to the client console. More...
 
virtual void ClearAdmin ()=0
 Removes admin access from the client.
 
virtual uint64_t GetSteamId64 (bool validated=true)=0
 Returns the client's Steam ID as a uint64. More...
 
virtual const char * GetSteam2Id (bool validated=true)=0
 Returns the client's Steam ID rendered in Steam2 format. More...
 
virtual const char * GetSteam3Id (bool validated=true)=0
 Returns the client's Steam ID rendered in Steam3 format. More...
 

Detailed Description

Abstracts some Half-Life 2 and SourceMod properties about clients.

Member Function Documentation

virtual AdminId SourceMod::IGamePlayer::GetAdminId ( )
pure virtual

Returns the client's AdminId, if any.

Returns
AdminId, or INVALID_ADMIN_ID if none.
virtual const char* SourceMod::IGamePlayer::GetAuthString ( bool  validated = true)
pure virtual

Returns the player's authentication string.

Parameters
validatedCheck backend validation status.
Returns
String containing the player's auth string. May be NULL if unavailable.
virtual edict_t* SourceMod::IGamePlayer::GetEdict ( )
pure virtual

Returns the player's edict_t structure.

Returns
edict_t pointer, or NULL if unavailable.
virtual int SourceMod::IGamePlayer::GetIndex ( ) const
pure virtual

Returns the client's edict/entity index.

Returns
Client's index.
virtual const char* SourceMod::IGamePlayer::GetIPAddress ( )
pure virtual

Returns the player's IP address.

Returns
String containing the player's IP address, or NULL if unavailable.
virtual unsigned int SourceMod::IGamePlayer::GetLanguageId ( )
pure virtual

Returns the client's language id.

Returns
Language id.
virtual const char* SourceMod::IGamePlayer::GetName ( )
pure virtual

Returns the player's name.

Returns
String containing the player's name, or NULL if unavailable.
virtual IPlayerInfo* SourceMod::IGamePlayer::GetPlayerInfo ( )
pure virtual

Returns a player's IPlayerInfo object, if any.

Returns
IPlayerInfo pointer, or NULL if none.
virtual unsigned int SourceMod::IGamePlayer::GetSerial ( )
pure virtual

Returns the clients unique serial identifier.

Returns
Serial number.
virtual const char* SourceMod::IGamePlayer::GetSteam2Id ( bool  validated = true)
pure virtual

Returns the client's Steam ID rendered in Steam2 format.

Parameters
validatedCheck backend validation status.
Returns
Steam2 Id on success or NULL if not available.
virtual const char* SourceMod::IGamePlayer::GetSteam3Id ( bool  validated = true)
pure virtual

Returns the client's Steam ID rendered in Steam3 format.

Parameters
validatedCheck backend validation status.
Returns
Steam3 Id on success or NULL if not available.
virtual unsigned int SourceMod::IGamePlayer::GetSteamAccountID ( bool  validated = true)
pure virtual

Returns the client's Steam account ID.

Parameters
validatedCheck backend validation status.
Returns
Steam account ID or 0 if not available.
virtual uint64_t SourceMod::IGamePlayer::GetSteamId64 ( bool  validated = true)
pure virtual

Returns the client's Steam ID as a uint64.

Parameters
validatedCheck backend validation status.
Returns
Steam Id or 0 if not available.
virtual int SourceMod::IGamePlayer::GetUserId ( )
pure virtual

Returns the client's userid.

Returns
Userid.
virtual bool SourceMod::IGamePlayer::IsAuthorized ( )
pure virtual

Return whether the client is authorized.

Returns
True if authorized, false otherwise.
virtual bool SourceMod::IGamePlayer::IsConnected ( )
pure virtual

Returns whether the player is connected.

Note: If this returns true, all above functions except for GetAuthString() should return non-NULL results.

Returns
True if connected, false otherwise.
virtual bool SourceMod::IGamePlayer::IsFakeClient ( )
pure virtual

Returns whether the player is a fake client.

Returns
True if a fake client, false otherwise.
virtual bool SourceMod::IGamePlayer::IsInGame ( )
pure virtual

Returns whether the player is in game (putinserver).

Returns
True if in game, false otherwise.
virtual bool SourceMod::IGamePlayer::IsInKickQueue ( )
pure virtual

Returns whether the client is marked as being in the kick queue. The client doesn't necessarily have to be in the actual kick queue for this function to return true.

Returns
True if in the kick queue, false otherwise.
virtual bool SourceMod::IGamePlayer::IsReplay ( ) const
pure virtual

Returns whether the player is the Replay bot.

Returns
True if the Replay bot, false otherwise.
virtual bool SourceMod::IGamePlayer::IsSourceTV ( ) const
pure virtual

Returns whether the player is the SourceTV bot.

Returns
True if the SourceTV bot, false otherwise.
virtual void SourceMod::IGamePlayer::Kick ( const char *  message)
pure virtual

Kicks the client with a message.

Parameters
messageThe message shown to the client when kicked
virtual void SourceMod::IGamePlayer::NotifyPostAdminChecks ( )
pure virtual

Notifies all listeners that the client has completed all of your post-connection (in-game, auth, admin) checks.

If you returned "false" from OnClientPreAdminCheck(), you must ALWAYS manually invoke this function, even if RunAdminCacheChecks() failed or you did not assign an AdminId. Failure to call this function could result in plugins (such as reservedslots) not working properly.

If you are implementing asynchronous fetches, and the client disconnects during your fetching process, you should make sure to recognize that case and not call this function. That is, do not call this function on mismatched PreCheck calls, or on disconnected clients. A good way to check this is to pass userids around, which are unique per client connection.

Calling this has no effect if it has already been called on the given client (thus it is safe for multiple asynchronous plugins to call it at various times).

virtual void SourceMod::IGamePlayer::PrintToConsole ( const char *  pMsg)
pure virtual

Prints a string to the client console.

Parameters
pMsgString to print.
virtual bool SourceMod::IGamePlayer::RunAdminCacheChecks ( )
pure virtual

Runs through Core's admin authorization checks. If the client is already an admin, no checks are performed.

Note that this function operates solely against the in-memory admin cache. It will check steamids, IPs, names, and verify a password if one exists. To implement other authentication schemes, simply don't call this function and use IGamePlayer::SetAdminId() instead.

Returns
True if access changed, false otherwise.
virtual void SourceMod::IGamePlayer::SetAdminId ( AdminId  id,
bool  temp 
)
pure virtual

Sets the client's AdminId.

Parameters
idAdminId to set.
tempIf true, the id will be invalidated on disconnect.

The documentation for this class was generated from the following file: