IPlayer
Interface IPlayer
Namespace: SwiftlyS2.Shared.Players
Assembly: SwiftlyS2.CS2.dll
public interface IPlayer : IEquatable<IPlayer>Implements
Properties
ConnectedTime
Gets the total time, in seconds, that the connection has been active.
uint ConnectedTime { get; }Controller
Gets the player controller associated with the player.
CCSPlayerController Controller { get; }IPAddress
Gets the IP address associated with the player.
string IPAddress { get; }IsAuthorized
Whether the current user is authorized by Steam.
bool IsAuthorized { get; }IsFakeClient
Whether the client is a bot.
bool IsFakeClient { get; }IsFirstSpawn
Indicates whether this is the player's first spawn.
bool IsFirstSpawn { get; }IsValid
Checks if the player is valid (has controller, is not HLTV, is connected and has pawn).
bool IsValid { get; }Pawn
Gets the pawn associated with the player.
CBasePlayerPawn? Pawn { get; }PlayerID
Gets the unique identifier for the player.
int PlayerID { get; }PlayerLanguage
Gets the language for the player.
Language PlayerLanguage { get; }PlayerPawn
Gets the player pawn associated with the player.
CCSPlayerPawn? PlayerPawn { get; }PressedButtons
Gets the set of game buttons that are currently pressed.
GameButtonFlags PressedButtons { get; }RequiredController
Gets the player controller associated with the player. Requires the controller to be valid. Thrown when the controller is not valid.
CCSPlayerController RequiredController { get; }RequiredPawn
Gets the pawn associated with the player. Requires the pawn to be valid. Thrown when the pawn is not valid.
CBasePlayerPawn RequiredPawn { get; }RequiredPlayerPawn
Gets the player pawn associated with the player. Requires the player pawn to be valid. Thrown when the player pawn is not valid.
CCSPlayerPawn RequiredPlayerPawn { get; }Slot
Gets the slot of the player. Equals to the player ID.
int Slot { get; }SteamID
Gets the unique Steam identifier associated with the user.
ulong SteamID { get; }UnauthorizedSteamID
Gets the Steam ID that was not verified yet.
ulong UnauthorizedSteamID { get; }UserID
Gets the user ID for the player.
int UserID { get; }VoiceFlags
Gets or sets the set of flags that specify voice options or features to be applied.
VoiceFlagValue VoiceFlags { get; set; }Methods
ChangeTeam(Team)
Changes the player's team.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void ChangeTeam(Team team)- team Team — The team to assign. Cannot be null.
ChangeTeamAsync(Team)
Changes the player's team asynchronously.
Task ChangeTeamAsync(Team team)- team Team — The team to assign. Cannot be null.
ClearTransmitEntityBlocks()
Removes all entity blocks from the transmit buffer, discarding any pending data scheduled for transmission.
void ClearTransmitEntityBlocks()ExecuteCommand(string)
Executes a command on behalf of the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void ExecuteCommand(string command)- command string
ExecuteCommandAsync(string)
Executes a command on behalf of the player asynchronously.
Task ExecuteCommandAsync(string command)- command string — The command to execute. Cannot be null or empty.
GetListenOverride(int)
Retrieves the listen override settings for the specified player.
ListenOverride GetListenOverride(int player)- player int — The identifier of the player whose listen override settings are to be retrieved. Must be a valid player index.
- ListenOverride — A ListenOverride object containing the listen override settings for the specified player.
IsTransmitEntityBlocked(int)
Determines whether the specified entity is currently blocked from transmitting data.
bool IsTransmitEntityBlocked(int entityid)- entityid int — The unique identifier of the entity to check for transmit blocking. Must be a valid entity ID.
- bool — true if the entity is blocked from transmitting; otherwise, false.
Kick(string, ENetworkDisconnectionReason)
Disconnects the user from the network session, providing a specified reason and disconnection type.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void Kick(string reason, ENetworkDisconnectionReason gameReason)- reason string — The message describing the reason for the disconnection. This message may be displayed to the user. Cannot be null or empty.
- gameReason ENetworkDisconnectionReason — The disconnection reason code indicating the type of network disconnection to perform.
KickAsync(string, ENetworkDisconnectionReason)
Disconnects the user from the network session, providing a specified reason and disconnection type asynchronously.
Task KickAsync(string reason, ENetworkDisconnectionReason gameReason)- reason string — The message describing the reason for the disconnection. This message may be displayed to the user. Cannot be null or empty.
- gameReason ENetworkDisconnectionReason — The disconnection reason code indicating the type of network disconnection to perform.
Respawn()
Respawns the player.
void Respawn()SendAlert(string)
Sends an alert message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendAlert(string message)- message string — The content of the message to send. Cannot be null.
SendAlertAsync(string)
Sends an alert message to the player asynchronously.
Task SendAlertAsync(string message)- message string — The content of the message to send. Cannot be null.
SendCenter(string)
Sends a center message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendCenter(string message)- message string — The content of the message to send. Cannot be null.
SendCenterAsync(string)
Sends a center message to the player asynchronously.
Task SendCenterAsync(string message)- message string — The content of the message to send. Cannot be null.
SendCenterHTML(string, int)
Sends a center HTML message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendCenterHTML(string message, int duration = 5000)- message string — The content of the message to send. Cannot be null.
- duration int — The duration, in milliseconds, for which the message should be displayed in HTML format.
SendCenterHTMLAsync(string, int)
Sends a center HTML message to the player asynchronously.
Task SendCenterHTMLAsync(string message, int duration = 5000)- message string — The content of the message to send. Cannot be null.
- duration int — The duration, in milliseconds, for which the message should be displayed in HTML format.
SendChat(string)
Sends a chat message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendChat(string message)- message string — The content of the message to send. Cannot be null.
SendChatAsync(string)
Sends a chat message to the player asynchronously.
Task SendChatAsync(string message)- message string — The content of the message to send. Cannot be null.
SendChatEOT(string)
Sends an end-of-text chat message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendChatEOT(string message)- message string — The content of the message to send. Cannot be null.
SendChatEOTAsync(string)
Sends an end-of-text chat message to the player asynchronously.
Task SendChatEOTAsync(string message)- message string — The content of the message to send. Cannot be null.
SendConsole(string)
Sends a console message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendConsole(string message)- message string — The content of the message to send. Cannot be null.
SendConsoleAsync(string)
Sends a console message to the player asynchronously.
Task SendConsoleAsync(string message)- message string — The content of the message to send. Cannot be null.
SendMessage(MessageType, string)
Sends a message of the specified type to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendMessage(MessageType kind, string message)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- message string — The content of the message to send. Cannot be null.
SendMessage(MessageType, string, int)
Sends a message of the specified type to the player with a custom HTML duration.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendMessage(MessageType kind, string message, int htmlDuration = 5000)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- message string — The content of the message to send. Cannot be null.
- htmlDuration int — The duration, in milliseconds, for which the message should be displayed in HTML format.
SendMessageAsync(MessageType, string)
Sends a message of the specified type to the player asynchronously.
Task SendMessageAsync(MessageType kind, string message)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- message string — The content of the message to send. Cannot be null.
SendMessageAsync(MessageType, string, int)
Sends a message of the specified type to the player asynchronously with a custom HTML duration.
Task SendMessageAsync(MessageType kind, string message, int htmlDuration = 5000)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- message string — The content of the message to send. Cannot be null.
- htmlDuration int — The duration, in milliseconds, for which the message should be displayed in HTML format.
SendNotify(string)
Sends a notify message to the player.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendNotify(string message)- message string — The content of the message to send. Cannot be null.
SendNotifyAsync(string)
Sends a notify message to the player asynchronously.
Task SendNotifyAsync(string message)- message string — The content of the message to send. Cannot be null.
SetListenOverride(int, ListenOverride)
Sets a custom listen override for the specified player.
void SetListenOverride(int player, ListenOverride listenOverride)- player int — The identifier of the player whose listen override setting will be updated. Must be a valid player index.
- listenOverride ListenOverride — The listen override value to apply to the specified player.
ShouldBlockTransmitEntity(int, bool)
Sets whether transmission of the specified entity should be blocked.
void ShouldBlockTransmitEntity(int entityid, bool shouldBlockTransmit)- entityid int — The unique identifier of the entity whose transmission status is to be updated.
- shouldBlockTransmit bool — A value indicating whether transmission for the entity should be blocked. Specify true to block transmission; otherwise, false.
SwitchTeam(Team)
Switches the player's team.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SwitchTeam(Team team)- team Team — The team to switch to. Cannot be null.
SwitchTeamAsync(Team)
Switches the player's team asynchronously.
Task SwitchTeamAsync(Team team)- team Team — The team to switch to. Cannot be null.
TakeDamage(CTakeDamageInfo)
Applies damage to the entity based on the specified damage information.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void TakeDamage(CTakeDamageInfo damageInfo)- damageInfo CTakeDamageInfo — An object containing details about the damage to be applied, including the amount, type, and source. Cannot be null.
TakeDamageAsync(CTakeDamageInfo)
Applies damage to the entity based on the specified damage information asynchronously.
Task TakeDamageAsync(CTakeDamageInfo damageInfo)- damageInfo CTakeDamageInfo — An object containing details about the damage to be applied, including the amount, type, and source. Cannot be null.
Teleport(Vector, QAngle, Vector)
Teleports the entity to the specified position, orientation, and velocity.
Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void Teleport(Vector pos, QAngle angle, Vector velocity)- pos Vector — The target position to teleport the entity to, represented as a SwiftlyS2.Shared.Natives.Vector.
- angle QAngle — The orientation to apply to the entity after teleportation, represented as a SwiftlyS2.Shared.Natives.QAngle.
- velocity Vector — The velocity to assign to the entity upon arrival, represented as a SwiftlyS2.Shared.Natives.Vector.
TeleportAsync(Vector, QAngle, Vector)
Teleports the entity to the specified position, orientation, and velocity asynchronously.
Task TeleportAsync(Vector pos, QAngle angle, Vector velocity)- pos Vector — The target position to teleport the entity to, represented as a SwiftlyS2.Shared.Natives.Vector.
- angle QAngle — The orientation to apply to the entity after teleportation, represented as a SwiftlyS2.Shared.Natives.QAngle.
- velocity Vector — The velocity to assign to the entity upon arrival, represented as a SwiftlyS2.Shared.Natives.Vector.