Class CCSPlayerController
- Namespace
- CounterStrikeSharp.API.Core
- Assembly
- CounterStrikeSharp.API.dll
public class CCSPlayerController : CBasePlayerController, IEquatable<CEntityInstance>
- Inheritance
-
objectCCSPlayerController
- 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
AbandonOffersInstantSurrender
[SchemaMember("CCSPlayerController", "m_bAbandonOffersInstantSurrender")]
public ref bool AbandonOffersInstantSurrender { get; }
Property Value
ActionTrackingServices
[SchemaMember("CCSPlayerController", "m_pActionTrackingServices")]
public CCSPlayerController_ActionTrackingServices? ActionTrackingServices { get; }
Property Value
ActiveQuestId
[SchemaMember("CCSPlayerController", "m_unActiveQuestId")]
public ref ushort ActiveQuestId { get; }
Property Value
AttemptedToGetColor
[SchemaMember("CCSPlayerController", "m_bAttemptedToGetColor")]
public ref bool AttemptedToGetColor { get; }
Property Value
AuthorizedSteamID
Returns the authorized SteamID of this user which has been validated with the SteamAPI.
public SteamID? AuthorizedSteamID { get; }
Property Value
Exceptions
- InvalidOperationException
Entity is not valid
BotsControlledThisRound
[SchemaMember("CCSPlayerController", "m_nBotsControlledThisRound")]
public ref int BotsControlledThisRound { get; }
Property Value
Buttons
Gets the active pawns button state. Will work even if the player is dead or observing.
public PlayerButtons Buttons { get; }
Property Value
CanControlObservedBot
[SchemaMember("CCSPlayerController", "m_bCanControlObservedBot")]
public ref bool CanControlObservedBot { get; }
Property Value
CannotBeKicked
[SchemaMember("CCSPlayerController", "m_bCannotBeKicked")]
public ref bool CannotBeKicked { get; }
Property Value
Clan
[SchemaMember("CCSPlayerController", "m_szClan")]
public string Clan { get; set; }
Property Value
ClanName
[SchemaMember("CCSPlayerController", "m_szClanName")]
public string ClanName { get; set; }
Property Value
CoachingTeam
[SchemaMember("CCSPlayerController", "m_iCoachingTeam")]
public ref int CoachingTeam { get; }
Property Value
CompTeammateColor
[SchemaMember("CCSPlayerController", "m_iCompTeammateColor")]
public ref int CompTeammateColor { get; }
Property Value
CompetitiveRankType
[SchemaMember("CCSPlayerController", "m_iCompetitiveRankType")]
public ref sbyte CompetitiveRankType { get; }
Property Value
CompetitiveRanking
[SchemaMember("CCSPlayerController", "m_iCompetitiveRanking")]
public ref int CompetitiveRanking { get; }
Property Value
CompetitiveRankingPredicted_Loss
[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Loss")]
public ref int CompetitiveRankingPredicted_Loss { get; }
Property Value
CompetitiveRankingPredicted_Tie
[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Tie")]
public ref int CompetitiveRankingPredicted_Tie { get; }
Property Value
CompetitiveRankingPredicted_Win
[SchemaMember("CCSPlayerController", "m_iCompetitiveRankingPredicted_Win")]
public ref int CompetitiveRankingPredicted_Win { get; }
Property Value
CompetitiveWins
[SchemaMember("CCSPlayerController", "m_iCompetitiveWins")]
public ref int CompetitiveWins { get; }
Property Value
ControllingBot
[SchemaMember("CCSPlayerController", "m_bControllingBot")]
public ref bool ControllingBot { get; }
Property Value
CrosshairCodes
[SchemaMember("CCSPlayerController", "m_szCrosshairCodes")]
public string CrosshairCodes { get; set; }
Property Value
DamageServices
[SchemaMember("CCSPlayerController", "m_pDamageServices")]
public CCSPlayerController_DamageServices? DamageServices { get; }
Property Value
DblLastReceivedPacketPlatFloatTime
[SchemaMember("CCSPlayerController", "m_dblLastReceivedPacketPlatFloatTime")]
public ref double DblLastReceivedPacketPlatFloatTime { get; }
Property Value
DesiredObserverMode
[SchemaMember("CCSPlayerController", "m_DesiredObserverMode")]
public ref int DesiredObserverMode { get; }
Property Value
DesiredObserverTarget
[SchemaMember("CCSPlayerController", "m_hDesiredObserverTarget")]
public CHandle<CEntityInstance> DesiredObserverTarget { get; }
Property Value
Disconnection1MinWarningPrinted
[SchemaMember("CCSPlayerController", "m_bDisconnection1MinWarningPrinted")]
public ref bool Disconnection1MinWarningPrinted { get; }
Property Value
DisconnectionTick
[SchemaMember("CCSPlayerController", "m_nDisconnectionTick")]
public ref int DisconnectionTick { get; }
Property Value
DraftIndex
[SchemaMember("CCSPlayerController", "m_iDraftIndex")]
public ref int DraftIndex { get; }
Property Value
EndMatchNextMapVote
[SchemaMember("CCSPlayerController", "m_nEndMatchNextMapVote")]
public ref int EndMatchNextMapVote { get; }
Property Value
EverFullyConnected
[SchemaMember("CCSPlayerController", "m_bEverFullyConnected")]
public ref bool EverFullyConnected { get; }
Property Value
EverPlayedOnTeam
[SchemaMember("CCSPlayerController", "m_bEverPlayedOnTeam")]
public ref bool EverPlayedOnTeam { get; }
Property Value
FireBulletsSeedSynchronized
[SchemaMember("CCSPlayerController", "m_bFireBulletsSeedSynchronized")]
public ref bool FireBulletsSeedSynchronized { get; }
Property Value
FirstKill
[SchemaMember("CCSPlayerController", "m_nFirstKill")]
public ref byte FirstKill { get; }
Property Value
ForceTeamTime
[SchemaMember("CCSPlayerController", "m_flForceTeamTime")]
public ref float ForceTeamTime { get; }
Property Value
GaveTeamDamageWarning
[SchemaMember("CCSPlayerController", "m_bGaveTeamDamageWarning")]
public ref bool GaveTeamDamageWarning { get; }
Property Value
GaveTeamDamageWarningThisRound
[SchemaMember("CCSPlayerController", "m_bGaveTeamDamageWarningThisRound")]
public ref bool GaveTeamDamageWarningThisRound { get; }
Property Value
HasBeenControlledByPlayerThisRound
[SchemaMember("CCSPlayerController", "m_bHasBeenControlledByPlayerThisRound")]
public ref bool HasBeenControlledByPlayerThisRound { get; }
Property Value
HasCommunicationAbuseMute
[SchemaMember("CCSPlayerController", "m_bHasCommunicationAbuseMute")]
public ref bool HasCommunicationAbuseMute { get; }
Property Value
HasControlledBotThisRound
[SchemaMember("CCSPlayerController", "m_bHasControlledBotThisRound")]
public ref bool HasControlledBotThisRound { get; }
Property Value
HasSeenJoinGame
[SchemaMember("CCSPlayerController", "m_bHasSeenJoinGame")]
public ref bool HasSeenJoinGame { get; }
Property Value
InGameMoneyServices
[SchemaMember("CCSPlayerController", "m_pInGameMoneyServices")]
public CCSPlayerController_InGameMoneyServices? InGameMoneyServices { get; }
Property Value
InSwitchTeam
[SchemaMember("CCSPlayerController", "m_bInSwitchTeam")]
public ref bool InSwitchTeam { get; }
Property Value
InventoryServices
[SchemaMember("CCSPlayerController", "m_pInventoryServices")]
public CCSPlayerController_InventoryServices? InventoryServices { get; }
Property Value
IpAddress
Returns the IP address (and possibly port) of this player.
public string? IpAddress { get; }
Property Value
Exceptions
- InvalidOperationException
Entity is not valid
IsBot
public bool IsBot { get; }
Property Value
JustBecameSpectator
[SchemaMember("CCSPlayerController", "m_bJustBecameSpectator")]
public ref bool JustBecameSpectator { get; }
Property Value
JustDidTeamKill
[SchemaMember("CCSPlayerController", "m_bJustDidTeamKill")]
public ref bool JustDidTeamKill { get; }
Property Value
KillCount
[SchemaMember("CCSPlayerController", "m_nKillCount")]
public ref byte KillCount { get; }
Property Value
LastHeldVoteTimer
[SchemaMember("CCSPlayerController", "m_lastHeldVoteTimer")]
public IntervalTimer LastHeldVoteTimer { get; }
Property Value
LastJoinTeamTime
[SchemaMember("CCSPlayerController", "m_flLastJoinTeamTime")]
public ref float LastJoinTeamTime { get; }
Property Value
LastTeamDamageWarningTime
[SchemaMember("CCSPlayerController", "m_LastTeamDamageWarningTime")]
public ref float LastTeamDamageWarningTime { get; }
Property Value
LastTimePlayerWasDisconnectedForPawnsRemove
[SchemaMember("CCSPlayerController", "m_LastTimePlayerWasDisconnectedForPawnsRemove")]
public ref float LastTimePlayerWasDisconnectedForPawnsRemove { get; }
Property Value
MVPs
[SchemaMember("CCSPlayerController", "m_iMVPs")]
public ref int MVPs { get; }
Property Value
MsQueuedModeDisconnectionTimestamp
[SchemaMember("CCSPlayerController", "m_msQueuedModeDisconnectionTimestamp")]
public ref uint MsQueuedModeDisconnectionTimestamp { get; }
Property Value
MusicKitID
[SchemaMember("CCSPlayerController", "m_iMusicKitID")]
public ref int MusicKitID { get; }
Property Value
MusicKitMVPs
[SchemaMember("CCSPlayerController", "m_iMusicKitMVPs")]
public ref int MusicKitMVPs { get; }
Property Value
MvpNoMusic
[SchemaMember("CCSPlayerController", "m_bMvpNoMusic")]
public ref bool MvpNoMusic { get; }
Property Value
MvpReason
[SchemaMember("CCSPlayerController", "m_eMvpReason")]
public ref int MvpReason { get; }
Property Value
NextTimeCheck
[SchemaMember("CCSPlayerController", "m_iNextTimeCheck")]
public ref int NextTimeCheck { get; }
Property Value
NonSuspiciousHitStreak
[SchemaMember("CCSPlayerController", "m_nNonSuspiciousHitStreak")]
public ref uint NonSuspiciousHitStreak { get; }
Property Value
ObserverPawn
[SchemaMember("CCSPlayerController", "m_hObserverPawn")]
public CHandle<CCSObserverPawn> ObserverPawn { get; }
Property Value
OriginalControllerOfCurrentPawn
[SchemaMember("CCSPlayerController", "m_hOriginalControllerOfCurrentPawn")]
public CHandle<CCSPlayerController> OriginalControllerOfCurrentPawn { get; }
Property Value
PawnArmor
[SchemaMember("CCSPlayerController", "m_iPawnArmor")]
public ref int PawnArmor { get; }
Property Value
PawnBotDifficulty
[SchemaMember("CCSPlayerController", "m_iPawnBotDifficulty")]
public ref int PawnBotDifficulty { get; }
Property Value
PawnCharacterDefIndex
[SchemaMember("CCSPlayerController", "m_nPawnCharacterDefIndex")]
public ref ushort PawnCharacterDefIndex { get; }
Property Value
PawnHasDefuser
[SchemaMember("CCSPlayerController", "m_bPawnHasDefuser")]
public ref bool PawnHasDefuser { get; }
Property Value
PawnHasHelmet
[SchemaMember("CCSPlayerController", "m_bPawnHasHelmet")]
public ref bool PawnHasHelmet { get; }
Property Value
PawnHealth
[SchemaMember("CCSPlayerController", "m_iPawnHealth")]
public ref uint PawnHealth { get; }
Property Value
PawnIsAlive
[SchemaMember("CCSPlayerController", "m_bPawnIsAlive")]
public ref bool PawnIsAlive { get; }
Property Value
PawnLifetimeEnd
[SchemaMember("CCSPlayerController", "m_iPawnLifetimeEnd")]
public ref int PawnLifetimeEnd { get; }
Property Value
PawnLifetimeStart
[SchemaMember("CCSPlayerController", "m_iPawnLifetimeStart")]
public ref int PawnLifetimeStart { get; }
Property Value
PendingTeamNum
[SchemaMember("CCSPlayerController", "m_iPendingTeamNum")]
public ref byte PendingTeamNum { get; }
Property Value
Ping
[SchemaMember("CCSPlayerController", "m_iPing")]
public ref uint Ping { get; }
Property Value
PlayerDominated
[SchemaMember("CCSPlayerController", "m_nPlayerDominated")]
public ref ulong PlayerDominated { get; }
Property Value
PlayerDominatingMe
[SchemaMember("CCSPlayerController", "m_nPlayerDominatingMe")]
public ref ulong PlayerDominatingMe { get; }
Property Value
PlayerPawn
[SchemaMember("CCSPlayerController", "m_hPlayerPawn")]
public CHandle<CCSPlayerPawn> PlayerPawn { get; }
Property Value
PlayerTvControlFlags
[SchemaMember("CCSPlayerController", "m_unPlayerTvControlFlags")]
public ref uint PlayerTvControlFlags { get; }
Property Value
PunishForTeamKill
[SchemaMember("CCSPlayerController", "m_bPunishForTeamKill")]
public ref bool PunishForTeamKill { get; }
Property Value
RecentKillQueue
[SchemaMember("CCSPlayerController", "m_recentKillQueue")]
public Span<byte> RecentKillQueue { get; }
Property Value
RemoveAllItemsOnNextRoundReset
[SchemaMember("CCSPlayerController", "m_bRemoveAllItemsOnNextRoundReset")]
public ref bool RemoveAllItemsOnNextRoundReset { get; }
Property Value
RoundScore
[SchemaMember("CCSPlayerController", "m_iRoundScore")]
public ref int RoundScore { get; }
Property Value
RoundsWon
[SchemaMember("CCSPlayerController", "m_iRoundsWon")]
public ref int RoundsWon { get; }
Property Value
Score
[SchemaMember("CCSPlayerController", "m_iScore")]
public ref int Score { get; }
Property Value
ScoreReported
[SchemaMember("CCSPlayerController", "m_bScoreReported")]
public ref bool ScoreReported { get; }
Property Value
ShowHints
[SchemaMember("CCSPlayerController", "m_bShowHints")]
public ref bool ShowHints { get; }
Property Value
Slot
public int Slot { get; }
Property Value
SmoothedPing
[SchemaMember("CCSPlayerController", "m_flSmoothedPing")]
public ref float SmoothedPing { get; }
Property Value
SuspiciousHitCount
[SchemaMember("CCSPlayerController", "m_nSuspiciousHitCount")]
public ref uint SuspiciousHitCount { get; }
Property Value
SwitchTeamsOnNextRoundReset
[SchemaMember("CCSPlayerController", "m_bSwitchTeamsOnNextRoundReset")]
public ref bool SwitchTeamsOnNextRoundReset { get; }
Property Value
Team
public CsTeam Team { get; }
Property Value
TeamChanged
[SchemaMember("CCSPlayerController", "m_bTeamChanged")]
public ref bool TeamChanged { get; }
Property Value
TeammatePreferredColor
[SchemaMember("CCSPlayerController", "m_iTeammatePreferredColor")]
public ref int TeammatePreferredColor { get; }
Property Value
UiAbandonRecordedReason
[SchemaMember("CCSPlayerController", "m_uiAbandonRecordedReason")]
public ref uint UiAbandonRecordedReason { get; }
Property Value
UpdateCounter
[SchemaMember("CCSPlayerController", "m_nUpdateCounter")]
public ref int UpdateCounter { get; }
Property Value
UserId
public int? UserId { get; }
Property Value
- int?
VoiceFlags
Determines how the player interacts with voice chat.
public VoiceFlags VoiceFlags { get; set; }
Property Value
Exceptions
- InvalidOperationException
Entity is not valid
Methods
ChangeTeam(CsTeam)
Switches the team of the player, has the same effect as the "jointeam" console command.
public void ChangeTeam(CsTeam team)
Parameters
team
CsTeamThe team to change to
Exceptions
- InvalidOperationException
Entity is not valid
CommitSuicide(bool, bool)
Force player suicide
public void CommitSuicide(bool explode, bool force)
Parameters
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).
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
GetConVarValue(string)
Get a ConVar value for given player
public string GetConVarValue(string conVar)
Parameters
conVar
stringName 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
Exceptions
- InvalidOperationException
Entity is not valid
GiveNamedItem(CsItem)
public nint GiveNamedItem(CsItem item)
Parameters
item
CsItem
Returns
GiveNamedItem(string)
public nint GiveNamedItem(string item)
Parameters
item
string
Returns
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
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
ReplicateConVar(string, string)
public void ReplicateConVar(string conVar, string value)
Parameters
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
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
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
CCSPlayerControllerPlayer talking in the voice chat
override
ListenOverrideWhether 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
CsTeamThe team to switch to
Exceptions
- InvalidOperationException
Entity is not valid
Teleport(Vector?, QAngle?, Vector?)
[Obsolete("You are trying to call Teleport on a non-physical player. Maybe you mean Pawn? (See: https://docs.cssharp.dev/docs/guides/referencing-players.html#controllers--pawns)")]
public void Teleport(Vector? position = null, QAngle? angles = null, Vector? velocity = null)