Table of Contents

Class CCSPlayerController

Namespace
CounterStrikeSharp.API.Core
Assembly
CounterStrikeSharp.API.dll
public class CCSPlayerController : CBasePlayerController, IEquatable<CEntityInstance>
Inheritance
CCSPlayerController
Implements
Inherited Members
Extension Methods

Constructors

CCSPlayerController(nint)

public CCSPlayerController(nint pointer)

Parameters

pointer nint

Properties

AbandonAllowsSurrender

[SchemaMember("CCSPlayerController", "m_bAbandonAllowsSurrender")]
public ref bool AbandonAllowsSurrender { get; }

Property Value

bool

AbandonOffersInstantSurrender

[SchemaMember("CCSPlayerController", "m_bAbandonOffersInstantSurrender")]
public ref bool AbandonOffersInstantSurrender { get; }

Property Value

bool

ActionTrackingServices

[SchemaMember("CCSPlayerController", "m_pActionTrackingServices")]
public CCSPlayerController_ActionTrackingServices? ActionTrackingServices { get; }

Property Value

CCSPlayerController_ActionTrackingServices

ActiveQuestId

[SchemaMember("CCSPlayerController", "m_unActiveQuestId")]
public ref ushort ActiveQuestId { get; }

Property Value

ushort

AttemptedToGetColor

[SchemaMember("CCSPlayerController", "m_bAttemptedToGetColor")]
public ref bool AttemptedToGetColor { get; }

Property Value

bool

AuthorizedSteamID

Returns the authorized SteamID of this user which has been validated with the SteamAPI.

public SteamID? AuthorizedSteamID { get; }

Property Value

SteamID

Exceptions

InvalidOperationException

Entity is not valid

BotsControlledThisRound

[SchemaMember("CCSPlayerController", "m_nBotsControlledThisRound")]
public ref int BotsControlledThisRound { get; }

Property Value

int

Buttons

Gets the active pawns button state. Will work even if the player is dead or observing.

public PlayerButtons Buttons { get; }

Property Value

PlayerButtons

CanControlObservedBot

[SchemaMember("CCSPlayerController", "m_bCanControlObservedBot")]
public ref bool CanControlObservedBot { get; }

Property Value

bool

CannotBeKicked

[SchemaMember("CCSPlayerController", "m_bCannotBeKicked")]
public ref bool CannotBeKicked { get; }

Property Value

bool

Clan

[SchemaMember("CCSPlayerController", "m_szClan")]
public string Clan { get; set; }

Property Value

string

ClanName

[SchemaMember("CCSPlayerController", "m_szClanName")]
public string ClanName { get; set; }

Property Value

string

CoachingTeam

[SchemaMember("CCSPlayerController", "m_iCoachingTeam")]
public ref int CoachingTeam { get; }

Property Value

int

CompTeammateColor

[SchemaMember("CCSPlayerController", "m_iCompTeammateColor")]
public ref int CompTeammateColor { get; }

Property Value

int

CompetitiveRankType

[SchemaMember("CCSPlayerController", "m_iCompetitiveRankType")]
public ref sbyte CompetitiveRankType { get; }

Property Value

sbyte

CompetitiveRanking

[SchemaMember("CCSPlayerController", "m_iCompetitiveRanking")]
public ref int CompetitiveRanking { get; }

Property Value

int

CompetitiveRankingPredicted_Loss

[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Loss")]
public ref int CompetitiveRankingPredicted_Loss { get; }

Property Value

int

CompetitiveRankingPredicted_Tie

[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Tie")]
public ref int CompetitiveRankingPredicted_Tie { get; }

Property Value

int

CompetitiveRankingPredicted_Win

[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Win")]
public ref int CompetitiveRankingPredicted_Win { get; }

Property Value

int

CompetitiveWins

[SchemaMember("CCSPlayerController", "m_iCompetitiveWins")]
public ref int CompetitiveWins { get; }

Property Value

int

ControllingBot

[SchemaMember("CCSPlayerController", "m_bControllingBot")]
public ref bool ControllingBot { get; }

Property Value

bool

CrosshairCodes

[SchemaMember("CCSPlayerController", "m_szCrosshairCodes")]
public string CrosshairCodes { get; set; }

Property Value

string

DamageServices

[SchemaMember("CCSPlayerController", "m_pDamageServices")]
public CCSPlayerController_DamageServices? DamageServices { get; }

Property Value

CCSPlayerController_DamageServices

DblLastReceivedPacketPlatFloatTime

[SchemaMember("CCSPlayerController", "m_dblLastReceivedPacketPlatFloatTime")]
public ref double DblLastReceivedPacketPlatFloatTime { get; }

Property Value

double

DesiredObserverMode

[SchemaMember("CCSPlayerController", "m_DesiredObserverMode")]
public ref int DesiredObserverMode { get; }

Property Value

int

DesiredObserverTarget

[SchemaMember("CCSPlayerController", "m_hDesiredObserverTarget")]
public CHandle<CEntityInstance> DesiredObserverTarget { get; }

Property Value

CHandle<CEntityInstance>

Disconnection1MinWarningPrinted

[SchemaMember("CCSPlayerController", "m_bDisconnection1MinWarningPrinted")]
public ref bool Disconnection1MinWarningPrinted { get; }

Property Value

bool

DisconnectionTick

[SchemaMember("CCSPlayerController", "m_nDisconnectionTick")]
public ref int DisconnectionTick { get; }

Property Value

int

DraftIndex

[SchemaMember("CCSPlayerController", "m_iDraftIndex")]
public ref int DraftIndex { get; }

Property Value

int

EndMatchNextMapVote

[SchemaMember("CCSPlayerController", "m_nEndMatchNextMapVote")]
public ref int EndMatchNextMapVote { get; }

Property Value

int

EverFullyConnected

[SchemaMember("CCSPlayerController", "m_bEverFullyConnected")]
public ref bool EverFullyConnected { get; }

Property Value

bool

EverPlayedOnTeam

[SchemaMember("CCSPlayerController", "m_bEverPlayedOnTeam")]
public ref bool EverPlayedOnTeam { get; }

Property Value

bool

ForceTeamTime

[SchemaMember("CCSPlayerController", "m_flForceTeamTime")]
public ref float ForceTeamTime { get; }

Property Value

float

GaveTeamDamageWarning

[SchemaMember("CCSPlayerController", "m_bGaveTeamDamageWarning")]
public ref bool GaveTeamDamageWarning { get; }

Property Value

bool

GaveTeamDamageWarningThisRound

[SchemaMember("CCSPlayerController", "m_bGaveTeamDamageWarningThisRound")]
public ref bool GaveTeamDamageWarningThisRound { get; }

Property Value

bool

HasBeenControlledByPlayerThisRound

[SchemaMember("CCSPlayerController", "m_bHasBeenControlledByPlayerThisRound")]
public ref bool HasBeenControlledByPlayerThisRound { get; }

Property Value

bool

HasCommunicationAbuseMute

[SchemaMember("CCSPlayerController", "m_bHasCommunicationAbuseMute")]
public ref bool HasCommunicationAbuseMute { get; }

Property Value

bool

HasControlledBotThisRound

[SchemaMember("CCSPlayerController", "m_bHasControlledBotThisRound")]
public ref bool HasControlledBotThisRound { get; }

Property Value

bool

HasSeenJoinGame

[SchemaMember("CCSPlayerController", "m_bHasSeenJoinGame")]
public ref bool HasSeenJoinGame { get; }

Property Value

bool

InGameMoneyServices

[SchemaMember("CCSPlayerController", "m_pInGameMoneyServices")]
public CCSPlayerController_InGameMoneyServices? InGameMoneyServices { get; }

Property Value

CCSPlayerController_InGameMoneyServices

InSwitchTeam

[SchemaMember("CCSPlayerController", "m_bInSwitchTeam")]
public ref bool InSwitchTeam { get; }

Property Value

bool

InventoryServices

[SchemaMember("CCSPlayerController", "m_pInventoryServices")]
public CCSPlayerController_InventoryServices? InventoryServices { get; }

Property Value

CCSPlayerController_InventoryServices

IpAddress

Returns the IP address (and possibly port) of this player. Returns 127.0.0.1 if the player is a bot.

public string? IpAddress { get; }

Property Value

string

Exceptions

InvalidOperationException

Entity is not valid

IsBot

public bool IsBot { get; }

Property Value

bool

JustBecameSpectator

[SchemaMember("CCSPlayerController", "m_bJustBecameSpectator")]
public ref bool JustBecameSpectator { get; }

Property Value

bool

JustDidTeamKill

[SchemaMember("CCSPlayerController", "m_bJustDidTeamKill")]
public ref bool JustDidTeamKill { get; }

Property Value

bool

Kills

[SchemaMember("CCSPlayerController", "m_vecKills")]
public NetworkedVector<EKillTypes_t> Kills { get; }

Property Value

NetworkedVector<EKillTypes_t>

LastHeldVoteTimer

[SchemaMember("CCSPlayerController", "m_lastHeldVoteTimer")]
public IntervalTimer LastHeldVoteTimer { get; }

Property Value

IntervalTimer

LastTeamDamageWarningTime

[SchemaMember("CCSPlayerController", "m_LastTeamDamageWarningTime")]
public ref float LastTeamDamageWarningTime { get; }

Property Value

float

LastTimePlayerWasDisconnectedForPawnsRemove

[SchemaMember("CCSPlayerController", "m_LastTimePlayerWasDisconnectedForPawnsRemove")]
public ref float LastTimePlayerWasDisconnectedForPawnsRemove { get; }

Property Value

float

MVPs

[SchemaMember("CCSPlayerController", "m_iMVPs")]
public ref int MVPs { get; }

Property Value

int

MsQueuedModeDisconnectionTimestamp

[SchemaMember("CCSPlayerController", "m_msQueuedModeDisconnectionTimestamp")]
public ref uint MsQueuedModeDisconnectionTimestamp { get; }

Property Value

uint

MusicKitID

[SchemaMember("CCSPlayerController", "m_iMusicKitID")]
public ref int MusicKitID { get; }

Property Value

int

MusicKitMVPs

[SchemaMember("CCSPlayerController", "m_iMusicKitMVPs")]
public ref int MusicKitMVPs { get; }

Property Value

int

MvpNoMusic

[SchemaMember("CCSPlayerController", "m_bMvpNoMusic")]
public ref bool MvpNoMusic { get; }

Property Value

bool

MvpReason

[SchemaMember("CCSPlayerController", "m_eMvpReason")]
public ref int MvpReason { get; }

Property Value

int

NextTimeCheck

[SchemaMember("CCSPlayerController", "m_iNextTimeCheck")]
public ref int NextTimeCheck { get; }

Property Value

int

NonSuspiciousHitStreak

[SchemaMember("CCSPlayerController", "m_nNonSuspiciousHitStreak")]
public ref uint NonSuspiciousHitStreak { get; }

Property Value

uint

ObserverPawn

[SchemaMember("CCSPlayerController", "m_hObserverPawn")]
public CHandle<CCSObserverPawn> ObserverPawn { get; }

Property Value

CHandle<CCSObserverPawn>

OriginalControllerOfCurrentPawn

[SchemaMember("CCSPlayerController", "m_hOriginalControllerOfCurrentPawn")]
public CHandle<CCSPlayerController> OriginalControllerOfCurrentPawn { get; }

Property Value

CHandle<CCSPlayerController>

PawnArmor

[SchemaMember("CCSPlayerController", "m_iPawnArmor")]
public ref int PawnArmor { get; }

Property Value

int

PawnBotDifficulty

[SchemaMember("CCSPlayerController", "m_iPawnBotDifficulty")]
public ref int PawnBotDifficulty { get; }

Property Value

int

PawnCharacterDefIndex

[SchemaMember("CCSPlayerController", "m_nPawnCharacterDefIndex")]
public ref ushort PawnCharacterDefIndex { get; }

Property Value

ushort

PawnHasDefuser

[SchemaMember("CCSPlayerController", "m_bPawnHasDefuser")]
public ref bool PawnHasDefuser { get; }

Property Value

bool

PawnHasHelmet

[SchemaMember("CCSPlayerController", "m_bPawnHasHelmet")]
public ref bool PawnHasHelmet { get; }

Property Value

bool

PawnHealth

[SchemaMember("CCSPlayerController", "m_iPawnHealth")]
public ref uint PawnHealth { get; }

Property Value

uint

PawnIsAlive

[SchemaMember("CCSPlayerController", "m_bPawnIsAlive")]
public ref bool PawnIsAlive { get; }

Property Value

bool

PawnLifetimeEnd

[SchemaMember("CCSPlayerController", "m_iPawnLifetimeEnd")]
public ref int PawnLifetimeEnd { get; }

Property Value

int

PawnLifetimeStart

[SchemaMember("CCSPlayerController", "m_iPawnLifetimeStart")]
public ref int PawnLifetimeStart { get; }

Property Value

int

PendingTeamNum

[SchemaMember("CCSPlayerController", "m_iPendingTeamNum")]
public ref byte PendingTeamNum { get; }

Property Value

byte

Ping

[SchemaMember("CCSPlayerController", "m_iPing")]
public ref uint Ping { get; }

Property Value

uint

PlayerDominated

[SchemaMember("CCSPlayerController", "m_nPlayerDominated")]
public ref ulong PlayerDominated { get; }

Property Value

ulong

PlayerDominatingMe

[SchemaMember("CCSPlayerController", "m_nPlayerDominatingMe")]
public ref ulong PlayerDominatingMe { get; }

Property Value

ulong

PlayerPawn

[SchemaMember("CCSPlayerController", "m_hPlayerPawn")]
public CHandle<CCSPlayerPawn> PlayerPawn { get; }

Property Value

CHandle<CCSPlayerPawn>

PlayerTvControlFlags

[SchemaMember("CCSPlayerController", "m_unPlayerTvControlFlags")]
public ref uint PlayerTvControlFlags { get; }

Property Value

uint

PunishForTeamKill

[SchemaMember("CCSPlayerController", "m_bPunishForTeamKill")]
public ref bool PunishForTeamKill { get; }

Property Value

bool

RemoveAllItemsOnNextRoundReset

[SchemaMember("CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset")]
public ref bool RemoveAllItemsOnNextRoundReset { get; }

Property Value

bool

RoundScore

[SchemaMember("CCSPlayerController", "m_iRoundScore")]
public ref int RoundScore { get; }

Property Value

int

RoundsWon

[SchemaMember("CCSPlayerController", "m_iRoundsWon")]
public ref int RoundsWon { get; }

Property Value

int

Score

[SchemaMember("CCSPlayerController", "m_iScore")]
public ref int Score { get; }

Property Value

int

ScoreReported

[SchemaMember("CCSPlayerController", "m_bScoreReported")]
public ref bool ScoreReported { get; }

Property Value

bool

ShowHints

[SchemaMember("CCSPlayerController", "m_bShowHints")]
public ref bool ShowHints { get; }

Property Value

bool

Slot

public int Slot { get; }

Property Value

int

SmoothedPing

[SchemaMember("CCSPlayerController", "m_flSmoothedPing")]
public ref float SmoothedPing { get; }

Property Value

float

SuspiciousHitCount

[SchemaMember("CCSPlayerController", "m_nSuspiciousHitCount")]
public ref uint SuspiciousHitCount { get; }

Property Value

uint

SwitchTeamsOnNextRoundReset

[SchemaMember("CCSPlayerController", "m_bSwitchTeamsOnNextRoundReset")]
public ref bool SwitchTeamsOnNextRoundReset { get; }

Property Value

bool

Team

public CsTeam Team { get; }

Property Value

CsTeam

TeamChanged

[SchemaMember("CCSPlayerController", "m_bTeamChanged")]
public ref bool TeamChanged { get; }

Property Value

bool

TeammatePreferredColor

[SchemaMember("CCSPlayerController", "m_iTeammatePreferredColor")]
public ref int TeammatePreferredColor { get; }

Property Value

int

UiAbandonRecordedReason

[SchemaMember("CCSPlayerController", "m_uiAbandonRecordedReason")]
public ref uint UiAbandonRecordedReason { get; }

Property Value

uint

UpdateCounter

[SchemaMember("CCSPlayerController", "m_nUpdateCounter")]
public ref int UpdateCounter { get; }

Property Value

int

UserId

public int? UserId { get; }

Property Value

int?

VoiceFlags

Determines how the player interacts with voice chat.

public VoiceFlags VoiceFlags { get; set; }

Property Value

VoiceFlags

Exceptions

InvalidOperationException

Entity is not valid

Methods

ChangeTeam(CsTeam)

Switches the team of the player, has the same effect as the "jointeam" console command. This follows gamemode rules, so this will usually cause a player suicide/loss of weapons.

public void ChangeTeam(CsTeam team)

Parameters

team CsTeam

The team to change to

Exceptions

InvalidOperationException

Entity is not valid

CommitSuicide(bool, bool)

Force player suicide

public void CommitSuicide(bool explode, bool force)

Parameters

explode bool
force bool

Exceptions

InvalidOperationException

Entity is not valid

Disconnect(NetworkDisconnectionReason)

Disconnects a player from the server with the specified reason.

public void Disconnect(NetworkDisconnectionReason reason)

Parameters

reason NetworkDisconnectionReason

DropActiveWeapon()

Drops the active player weapon on the ground.

public void DropActiveWeapon()

Exceptions

InvalidOperationException

Entity is not valid

ExecuteClientCommand(string)

Issue the specified command to the specified client (mimics that client typing the command at the console). Note: Only works for some commands, marked with the FCVAR_CLIENT_CAN_EXECUTE flag (not many).

public void ExecuteClientCommand(string command)

Parameters

command string

Exceptions

InvalidOperationException

Entity is not valid

ExecuteClientCommandFromServer(string)

Issue the specified command directly from the server (mimics the server executing the command with the given player context). Works with server commands like kill, explode, noclip, etc.

public void ExecuteClientCommandFromServer(string command)

Parameters

command string

Exceptions

InvalidOperationException

Entity is not valid

GetConVarValue(ConVar?)

public string GetConVarValue(ConVar? conVar)

Parameters

conVar ConVar

Returns

string

GetConVarValue(string)

Get a ConVar value for given player

public string GetConVarValue(string conVar)

Parameters

conVar string

Name of the convar to retrieve

Returns

string

ConVar string value

Exceptions

InvalidOperationException

Entity is not valid

GetListenOverride(CCSPlayerController)

public ListenOverride GetListenOverride(CCSPlayerController sender)

Parameters

sender CCSPlayerController

Returns

ListenOverride

Exceptions

InvalidOperationException

Entity is not valid

GiveNamedItem(CsItem)

public nint GiveNamedItem(CsItem item)

Parameters

item CsItem

Returns

nint

GiveNamedItem(string)

public nint GiveNamedItem(string item)

Parameters

item string

Returns

nint

Exceptions

InvalidOperationException

Entity is not valid

GiveNamedItem<T>(string)

public T? GiveNamedItem<T>(string item) where T : CEntityInstance

Parameters

item string

Returns

T

Type Parameters

T

PrintToCenter(string)

public void PrintToCenter(string message)

Parameters

message string

Exceptions

InvalidOperationException

Entity is not valid

PrintToCenterAlert(string)

public void PrintToCenterAlert(string message)

Parameters

message string

Exceptions

InvalidOperationException

Entity is not valid

PrintToCenterHtml(string)

public void PrintToCenterHtml(string message)

Parameters

message string

PrintToCenterHtml(string, int)

public void PrintToCenterHtml(string message, int duration)

Parameters

message string
duration int

Exceptions

InvalidOperationException

Entity is not valid

PrintToChat(string)

public void PrintToChat(string message)

Parameters

message string

Exceptions

InvalidOperationException

Entity is not valid

PrintToConsole(string)

public void PrintToConsole(string message)

Parameters

message string

Exceptions

InvalidOperationException

Entity is not valid

RemoveWeapons()

Removes every weapon from the player.

public void RemoveWeapons()

Exceptions

InvalidOperationException

Entity is not valid

Respawn()

Respawn player

public void Respawn()

Exceptions

InvalidOperationException

Entity is not valid

SetFakeClientConVar(ConVar, string)

Sets a ConVar value on a fake client (bot).

public void SetFakeClientConVar(ConVar conVar, string value)

Parameters

conVar ConVar

Console variable name

value string

String value to set

Exceptions

ArgumentException

conVar is null

InvalidOperationException

Entity is not valid

InvalidOperationException

Player is not a bot

SetFakeClientConVar(string, string)

Sets a ConVar value on a fake client (bot).

public void SetFakeClientConVar(string conVar, string value)

Parameters

conVar string

Console variable name

value string

String value to set

Exceptions

InvalidOperationException

Entity is not valid

InvalidOperationException

Player is not a bot

SetListenOverride(CCSPlayerController, ListenOverride)

Overrides who a player can hear in voice chat.

public void SetListenOverride(CCSPlayerController sender, ListenOverride @override)

Parameters

sender CCSPlayerController

Player talking in the voice chat

override ListenOverride

Whether the talker should be heard

Exceptions

InvalidOperationException

Entity is not valid

SwitchTeam(CsTeam)

Forcibly switches the team of the player, the player will remain alive and keep their weapons.

public void SwitchTeam(CsTeam team)

Parameters

team CsTeam

The team to switch to

Exceptions

InvalidOperationException

Entity is not valid