IPlayer
Interfacepublic interface IPlayer : IEquatable<IPlayer>Properties
Gets the total time, in seconds, that the connection has been active.
uint ConnectedTime { get; }Gets the player controller associated with the player.
CCSPlayerController Controller { get; }Gets the IP address associated with the player.
string IPAddress { get; }Gets a value indicating whether the player is currently alive.
bool IsAlive { get; }Whether the current user is authorized by Steam.
bool IsAuthorized { get; }Indicates whether this is the player's first spawn.
bool IsFirstSpawn { get; }Checks if the player is valid (has controller, is not HLTV, is connected and has pawn).
bool IsValid { get; }Gets the pawn associated with the player.
CBasePlayerPawn? Pawn { get; }Gets the language for the player.
Language PlayerLanguage { get; }Gets the player pawn associated with the player.
CCSPlayerPawn? PlayerPawn { get; }Gets the set of game buttons that are currently pressed.
GameButtonFlags PressedButtons { get; }Gets the player controller associated with the player. Requires the controller to be valid. System.InvalidOperationException?text=Thrown+when+the+controller+is+not+valid.
CCSPlayerController RequiredController { get; }Gets the pawn associated with the player. Requires the pawn to be valid. System.InvalidOperationException?text=Thrown+when+the+pawn+is+not+valid.
CBasePlayerPawn RequiredPawn { get; }Gets the player pawn associated with the player. Requires the player pawn to be valid. System.InvalidOperationException?text=Thrown+when+the+player+pawn+is+not+valid.
CCSPlayerPawn RequiredPlayerPawn { get; }Gets the server-side client associated with the player.
IServerSideClient ServerSideClient { get; }Gets the unique Steam identifier associated with the user.
ulong SteamID { get; }Gets the Steam ID that was not verified yet.
ulong UnauthorizedSteamID { get; }Gets or sets the set of flags that specify voice options or features to be applied.
VoiceFlagValue VoiceFlags { get; set; }Methods
Changes the player's team. This will also kill the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void ChangeTeam(Team team)- teamTeamThe team to assign. Cannot be null.
Changes the player's team asynchronously. This will also kill the player.
Task ChangeTeamAsync(Team team)- teamTeamThe team to assign. Cannot be null.
Removes all entity blocks from the transmit buffer, discarding any pending data scheduled for transmission.
void ClearTransmitEntityBlocks()Executes a command on behalf of the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void ExecuteCommand(string command)- commandstring
Executes a command on behalf of the player asynchronously.
Task ExecuteCommandAsync(string command)- commandstringThe command to execute. Cannot be null or empty.
Retrieves userinfo values for convars such as: m_yaw, sensitivity.
string GetClientConvarValue(string convarName)- convarNamestring
Retrieves the listen override settings for the specified player.
ListenOverride GetListenOverride(int player)- playerintThe identifier of the player whose listen override settings are to be retrieved. Must be a valid player index.
Determines whether the specified entity is currently blocked from transmitting data.
bool IsTransmitEntityBlocked(int entityid)- entityidintThe unique identifier of the entity to check for transmit blocking. Must be a valid entity ID.
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)- reasonstringThe message describing the reason for the disconnection. This message may be displayed to the user. Cannot be null or empty.
- gameReasonENetworkDisconnectionReasonThe disconnection reason code indicating the type of network disconnection to perform.
Disconnects the user from the network session, providing a specified reason and disconnection type asynchronously.
Task KickAsync(string reason, ENetworkDisconnectionReason gameReason)- reasonstringThe message describing the reason for the disconnection. This message may be displayed to the user. Cannot be null or empty.
- gameReasonENetworkDisconnectionReasonThe disconnection reason code indicating the type of network disconnection to perform.
Sends an alert message to the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendAlert(string message)- messagestringThe content of the message to send. Cannot be null.
Sends an alert message to the player asynchronously.
Task SendAlertAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a center message to the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendCenter(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a center message to the player asynchronously.
Task SendCenterAsync(string message)- messagestringThe content of the message to send. Cannot be null.
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)Sends a center HTML message to the player asynchronously.
Task SendCenterHTMLAsync(string message, int duration = 5000)Sends a chat message to the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendChat(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a chat message to the player asynchronously.
Task SendChatAsync(string message)- messagestringThe content of the message to send. Cannot be null.
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)- messagestringThe content of the message to send. Cannot be null.
Sends an end-of-text chat message to the player asynchronously.
Task SendChatEOTAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a console message to the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendConsole(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a console message to the player asynchronously.
Task SendConsoleAsync(string message)- messagestringThe content of the message to send. Cannot be null.
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)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messagestringThe content of the message to send. Cannot be null.
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)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messagestringThe content of the message to send. Cannot be null.
- htmlDurationintoptionalThe duration, in milliseconds, for which the message should be displayed in HTML format.
Sends a message of the specified type to the player asynchronously.
Task SendMessageAsync(MessageType kind, string message)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messagestringThe content of the message to send. Cannot be null.
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)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messagestringThe content of the message to send. Cannot be null.
- htmlDurationintoptionalThe duration, in milliseconds, for which the message should be displayed in HTML format.
Sends a notify message to the player. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendNotify(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a notify message to the player asynchronously.
Task SendNotifyAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sets a custom listen override for the specified player.
void SetListenOverride(int player, ListenOverride listenOverride)- playerintThe identifier of the player whose listen override setting will be updated. Must be a valid player index.
- listenOverrideListenOverrideThe listen override value to apply to the specified player.
Sets whether transmission of the specified entity should be blocked.
void ShouldBlockTransmitEntity(int entityid, bool shouldBlockTransmit)Switches the player's team. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SwitchTeam(Team team)- teamTeamThe team to switch to. Cannot be null.
Switches the player's team asynchronously.
Task SwitchTeamAsync(Team team)- teamTeamThe team to switch to. Cannot be null.
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)- damageInfoCTakeDamageInfoAn object containing details about the damage to be applied, including the amount, type, and source. Cannot be null.
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(float damage, DamageTypes_t damageType, CBaseEntity? inflictor = null, CBaseEntity? attacker = null, CBaseEntity? ability = null)- damagefloatThe amount of damage to apply.
- damageTypeDamageTypes_tThe type of damage to apply.
- inflictorCBaseEntity?optionalThe entity that is inflicting the damage. Can be null.
- attackerCBaseEntity?optionalThe entity that is attacking. Can be null.
- abilityCBaseEntity?optionalThe ability that caused the damage. Can be null.
Applies damage to the entity based on the specified damage information asynchronously.
Task TakeDamageAsync(CTakeDamageInfo damageInfo)- damageInfoCTakeDamageInfoAn object containing details about the damage to be applied, including the amount, type, and source. Cannot be null.
Applies damage to the entity based on the specified damage information asynchronously.
Task TakeDamageAsync(float damage, DamageTypes_t damageType, CBaseEntity? inflictor = null, CBaseEntity? attacker = null, CBaseEntity? ability = null)- damagefloatThe amount of damage to apply.
- damageTypeDamageTypes_tThe type of damage to apply.
- inflictorCBaseEntity?optionalThe entity that is inflicting the damage. Can be null.
- attackerCBaseEntity?optionalThe entity that is attacking. Can be null.
- abilityCBaseEntity?optionalThe ability that caused the damage. Can be null.
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)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 = null, QAngle? angle = null, Vector? velocity = null)Teleports the entity to the specified position, orientation, and velocity asynchronously.
Task TeleportAsync(Vector pos, QAngle angle, Vector velocity)Teleports the entity to the specified position, orientation, and velocity asynchronously.
Task TeleportAsync(Vector? pos = null, QAngle? angle = null, Vector? velocity = null)