IPlayerManagerService
Interfacepublic interface IPlayerManagerServiceProperties
Gets the maximum number of players allowed by the server configuration.
int MaxPlayers { get; }Gets the maximum number of players allowed by the engine.
int PlayerCap { get; }Gets the number of players currently in the game.
int PlayerCount { get; }Methods
Removes all entity transmission blocks, allowing all previously blocked entities to be transmitted to clients again.
void ClearAllBlockedTransmitEntities()Finds targetted players based on the provided search criteria.
IEnumerable<IPlayer> FindTargettedPlayers(IPlayer player, string target, TargetSearchMode searchMode, StringComparison nameComparison = StringComparison.OrdinalIgnoreCase)- playerIPlayerThe player initiating the search.
- targetstringThe target player name or identifier.
- searchModeTargetSearchModeThe search mode to apply.
- nameComparisonStringComparisonoptionalThe string comparison mode for name matching. Defaults to OrdinalIgnoreCase.
Retrieves all alive players currently online.
IEnumerable<IPlayer> GetAlive()Retrieves all players currently online.
IEnumerable<IPlayer> GetAllPlayers()Retrieves all valid players currently online.
IEnumerable<IPlayer> GetAllValidPlayers()Retrieves all bot players currently online.
IEnumerable<IPlayer> GetBots()Retrieves all CT players currently online.
IEnumerable<IPlayer> GetCT()Retrieves all alive CT players currently online.
IEnumerable<IPlayer> GetCTAlive()Retrieves all players in the specified team.
IEnumerable<IPlayer> GetInTeam(Team team)- teamTeamThe team for which to retrieve players.
Retrieves the player associated with the specified player ID.
IPlayer? GetPlayer(int playerid)- playeridintThe unique identifier of the player to retrieve. Must be a valid player ID.
Retrieves the player associated with the specified controller.
IPlayer? GetPlayerFromController(CBasePlayerController controller)- controllerCBasePlayerControllerThe controller to retrieve the player from.
Retrieves the player associated with the specified pawn.
IPlayer? GetPlayerFromPawn(CBasePlayerPawn pawn)- pawnCBasePlayerPawnThe pawn to retrieve the player from.
Retrieves the player associated with the specified session ID.
IPlayer? GetPlayerFromSessionId(ulong sessionId)- sessionIdulongThe session ID to retrieve the player from.
Retrieves the player associated with the specified Steam ID.
IPlayer? GetPlayerFromSteamId(ulong steamId, bool allowUnauthorized = true)Retrieves all spectator players currently online.
IEnumerable<IPlayer> GetSpectators()Retrieves all T players currently online.
IEnumerable<IPlayer> GetT()Retrieves all alive T players currently online.
IEnumerable<IPlayer> GetTAlive()Checks whether a specific player is currently online and connected to the server.
bool IsPlayerOnline(int playerid)- playeridint
Checks whether a specific session ID is valid. Session id will be invalid when the player associated is disconnected or doesn't exist.
bool IsSessionIdValid(ulong sessionId)- sessionIdulongThe session ID to check.
Sends an alert message to the players. 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 players asynchronously.
Task SendAlertAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a center message to the players. 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 players asynchronously.
Task SendCenterAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a center HTML message to the players. 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 players asynchronously.
Task SendCenterHTMLAsync(string message, int duration = 5000)Sends a chat message to the players. 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 players asynchronously.
Task SendChatAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends an end-of-text chat message to the players. 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 players asynchronously.
Task SendChatEOTAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Sends a console message to the players. 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 players asynchronously.
Task SendConsoleAsync(string message)- messagestringThe content of the message to send. Cannot be null.
Broadcasts a message to players using different display methods based on the message type. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendMessage(MessageType kind, string message)- kindMessageTypeThe type of message display.
- messagestringThe text content to send to players.
Sends a message of the specified type to the players 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.
Broadcasts a message to players using different display methods based on the message type. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendMessage(MessageType kind, Func<IPlayer, ILocalizer, string> messageCallback)- kindMessageTypeThe type of message display.
- messageCallbackFunc<IPlayer, ILocalizer, string>The text callback to send to players.
Sends a message of the specified type to the players with a custom HTML duration. Thread unsafe, use async variant instead for non-main thread context.
[ThreadUnsafe]
void SendMessage(MessageType kind, Func<IPlayer, ILocalizer, string> messageCallback, int htmlDuration = 5000)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messageCallbackFunc<IPlayer, ILocalizer, string>The callback 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 players 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 players 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.
Broadcasts a message to players using different display methods based on the message type. Thread unsafe, use async variant instead for non-main thread context.
Task SendMessageAsync(MessageType kind, Func<IPlayer, ILocalizer, string> messageCallback)- kindMessageTypeThe type of message display.
- messageCallbackFunc<IPlayer, ILocalizer, string>The text callback to send to players.
Sends a message of the specified type to the players with a custom HTML duration. Thread unsafe, use async variant instead for non-main thread context.
Task SendMessageAsync(MessageType kind, Func<IPlayer, ILocalizer, string> messageCallback, int htmlDuration = 5000)- kindMessageTypeThe type of message to send. Determines how the message is processed or displayed.
- messageCallbackFunc<IPlayer, ILocalizer, string>The callback 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 players. 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 players asynchronously.
Task SendNotifyAsync(string message)- messagestringThe content of the message to send. Cannot be null.