C# Class SharpMod.Player

Inheritance: Entity
Show file Open project: txdv/sharpmod Class Usage Examples

Public Methods

Method Description
Ban ( string message, int minutes ) : void

Issue the server commands to ban a player by ip.

ExecuteCommand ( string command ) : void

Executes a supplied command on the client side of the player.

Find ( string target ) : Player
FindByAuthId ( string authId ) : Player

Finds an active Player by authid.

FindByName ( string name ) : Player

Finds an active Player by name

FindByUserId ( int id ) : Player
FindByUserId ( string id ) : Player
GetInfoKeyValue ( string key ) : string

Gets a specific value for a key from the infokeybuffer

GetPlayer ( IntPtr entity ) : Player

Gets a Player according to the entity pointer. Needed most of the time for internal engine calls, since the entity pointer is used a lot.

GetUserID ( Player player ) : int
GiveItem ( string itemname ) : Entity
Kick ( string message ) : void

Issue the server command to kick this player.

PrintCenter ( string text ) : void

Prints some text to the Player central screen

PrintChat ( string text ) : void

Prints some text to the players text in one color.

PrintConsole ( string text ) : void

Prints some text to the Players Console.

RegisterCommand ( string str, ClientCommandDelegate handler ) : void
ReloadAllPrivileges ( ) : void
ReloadPrivileges ( ) : void
SetInfoKeyValue ( string key, string val ) : void

Sets some specific InfoKeyValue according to a key.

StripUserWeapons ( ) : void
ToString ( ) : string

Returns a string representation of the player class

UpdateUserInfo ( ) : void
UpdateUserInfo ( string infoString ) : void

Protected Methods

Method Description
OnAssignPrivileges ( AssignPrivilegesEventArgs args ) : void
OnAuthorize ( AuthorizeEventArgs args ) : void
OnCommand ( CommandEventArgs args ) : void
OnConnect ( ConnectEventArgs args ) : void
OnDisconnect ( DisconnectEventArgs args ) : void
OnPlayerAssignPrivileges ( AssignPrivilegesEventArgs args ) : void
OnPlayerAuthorize ( AuthorizeEventArgs args ) : void
OnPlayerClientDisconnect ( DisconnectEventArgs args ) : void
OnPlayerCommand ( CommandEventArgs args ) : void
OnPlayerConnect ( ConnectEventArgs args ) : void
OnPlayerPutInServer ( PutInServerEventArgs args ) : void
OnPutInServer ( PutInServerEventArgs args ) : void

Private Methods

Method Description
OnAssignPrivileges ( Player player, Privileges privileges ) : void
OnAuthorize ( Player player ) : void
OnCommand ( IntPtr entity ) : void
OnConnect ( IntPtr entity, string name, string address, string reject_reason ) : bool
OnDisconnect ( IntPtr entity ) : void
OnPutInServer ( IntPtr entity ) : void
Player ( IntPtr entity ) : System

Constructor for internal building of Players

Release ( ) : void

Releases the event handlers

ResolvedBans ( BanInfo information ) : void
ResolvedPrivileges ( PlayerInfo pi, Privileges priv ) : void

Method Details

Ban() public method

Issue the server commands to ban a player by ip.
public Ban ( string message, int minutes ) : void
message string /// A reason to kick/ban ///
minutes int /// The amount of minutes to ban a player by ip ///
return void

ExecuteCommand() public method

Executes a supplied command on the client side of the player.
public ExecuteCommand ( string command ) : void
command string /// A command as a string which must end with ; ///
return void

Find() public static method

public static Find ( string target ) : Player
target string
return Player

FindByAuthId() public static method

Finds an active Player by authid.
public static FindByAuthId ( string authId ) : Player
authId string /// AuthId to search by ///
return Player

FindByName() public static method

Finds an active Player by name
public static FindByName ( string name ) : Player
name string /// Name to search by ///
return Player

FindByUserId() public static method

public static FindByUserId ( int id ) : Player
id int
return Player

FindByUserId() public static method

public static FindByUserId ( string id ) : Player
id string
return Player

GetInfoKeyValue() public method

Gets a specific value for a key from the infokeybuffer
public GetInfoKeyValue ( string key ) : string
key string /// The key name ///
return string

GetPlayer() public static method

Gets a Player according to the entity pointer. Needed most of the time for internal engine calls, since the entity pointer is used a lot.
public static GetPlayer ( IntPtr entity ) : Player
entity System.IntPtr /// A pointer to the entity class ///
return Player

GetUserID() public static method

public static GetUserID ( Player player ) : int
player Player
return int

GiveItem() public method

public GiveItem ( string itemname ) : Entity
itemname string
return Entity

Kick() public method

Issue the server command to kick this player.
public Kick ( string message ) : void
message string /// A reason for kicking ///
return void

OnAssignPrivileges() protected static method

protected static OnAssignPrivileges ( AssignPrivilegesEventArgs args ) : void
args AssignPrivilegesEventArgs
return void

OnAuthorize() protected static method

protected static OnAuthorize ( AuthorizeEventArgs args ) : void
args AuthorizeEventArgs
return void

OnCommand() protected static method

protected static OnCommand ( CommandEventArgs args ) : void
args CommandEventArgs
return void

OnConnect() protected static method

protected static OnConnect ( ConnectEventArgs args ) : void
args ConnectEventArgs
return void

OnDisconnect() protected static method

protected static OnDisconnect ( DisconnectEventArgs args ) : void
args DisconnectEventArgs
return void

OnPlayerAssignPrivileges() protected method

protected OnPlayerAssignPrivileges ( AssignPrivilegesEventArgs args ) : void
args AssignPrivilegesEventArgs
return void

OnPlayerAuthorize() protected method

protected OnPlayerAuthorize ( AuthorizeEventArgs args ) : void
args AuthorizeEventArgs
return void

OnPlayerClientDisconnect() protected method

protected OnPlayerClientDisconnect ( DisconnectEventArgs args ) : void
args DisconnectEventArgs
return void

OnPlayerCommand() protected method

protected OnPlayerCommand ( CommandEventArgs args ) : void
args CommandEventArgs
return void

OnPlayerConnect() protected method

protected OnPlayerConnect ( ConnectEventArgs args ) : void
args ConnectEventArgs
return void

OnPlayerPutInServer() protected method

protected OnPlayerPutInServer ( PutInServerEventArgs args ) : void
args PutInServerEventArgs
return void

OnPutInServer() protected static method

protected static OnPutInServer ( PutInServerEventArgs args ) : void
args PutInServerEventArgs
return void

PrintCenter() public method

Prints some text to the Player central screen
public PrintCenter ( string text ) : void
text string /// Text to print ///
return void

PrintChat() public method

Prints some text to the players text in one color.
public PrintChat ( string text ) : void
text string /// Text to print ///
return void

PrintConsole() public method

Prints some text to the Players Console.
public PrintConsole ( string text ) : void
text string /// Text to print ///
return void

RegisterCommand() public static method

public static RegisterCommand ( string str, ClientCommandDelegate handler ) : void
str string
handler ClientCommandDelegate
return void

ReloadAllPrivileges() public static method

public static ReloadAllPrivileges ( ) : void
return void

ReloadPrivileges() public method

public ReloadPrivileges ( ) : void
return void

SetInfoKeyValue() public method

Sets some specific InfoKeyValue according to a key.
public SetInfoKeyValue ( string key, string val ) : void
key string /// The key ///
val string /// The value which has to be set to the key ///
return void

StripUserWeapons() public method

public StripUserWeapons ( ) : void
return void

ToString() public method

Returns a string representation of the player class
public ToString ( ) : string
return string

UpdateUserInfo() public method

public UpdateUserInfo ( ) : void
return void

UpdateUserInfo() public method

public UpdateUserInfo ( string infoString ) : void
infoString string
return void