IPlayerManagerService
Interface IPlayerManagerService
Namespace: SwiftlyS2.Shared.Players
Assembly: SwiftlyS2.CS2.dll
public interface IPlayerManagerServiceProperties
PlayerCap
Gets the maximum number of players allowed by the engine.
int PlayerCap { get; }PlayerCount
Gets the number of players currently in the game.
int PlayerCount { get; }Methods
ClearAllBlockedTransmitEntities()
Removes all entity transmission blocks, allowing all previously blocked entities to be transmitted to clients again.
void ClearAllBlockedTransmitEntities()FindTargettedPlayers(IPlayer, string, TargetSearchMode, StringComparison)
Finds targetted players based on the provided search criteria.
IEnumerable<IPlayer> FindTargettedPlayers(IPlayer player, string target, TargetSearchMode searchMode, StringComparison nameComparison = StringComparison.OrdinalIgnoreCase)- player IPlayer — The player initiating the search.
- target string — The target player name or identifier.
- searchMode TargetSearchMode — The search mode to apply.
- nameComparison StringComparison — The string comparison mode for name matching. Defaults to System.StringComparison.OrdinalIgnoreCase.
- IEnumerable<IPlayer> — A collection of players matching the search criteria.
GetAlive()
Retrieves all alive players currently online.
IEnumerable<IPlayer> GetAlive()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all alive players currently online.
GetAllPlayers()
Retrieves all players currently online.
IEnumerable<IPlayer> GetAllPlayers()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all online players.
GetBots()
Retrieves all bot players currently online.
IEnumerable<IPlayer> GetBots()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all online bot players.
GetCT()
Retrieves all CT players currently online.
IEnumerable<IPlayer> GetCT()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all CT players currently online.
GetCTAlive()
Retrieves all alive CT players currently online.
IEnumerable<IPlayer> GetCTAlive()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all alive CT players currently online.
GetInTeam(Team)
Retrieves all players in the specified team.
IEnumerable<IPlayer> GetInTeam(Team team)- team Team — The team for which to retrieve players.
- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all players in the specified team.
GetPlayer(int)
Retrieves the player associated with the specified player ID.
IPlayer? GetPlayer(int playerid)- playerid int — The unique identifier of the player to retrieve. Must be a valid player ID.
- IPlayer? — An SwiftlyS2.Shared.Players.IPlayer instance representing the player with the specified ID, or
nullif no such player exists.
GetSpectators()
Retrieves all spectator players currently online.
IEnumerable<IPlayer> GetSpectators()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all spectator players currently online.
GetT()
Retrieves all T players currently online.
IEnumerable<IPlayer> GetT()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all T players currently online.
GetTAlive()
Retrieves all alive T players currently online.
IEnumerable<IPlayer> GetTAlive()- IEnumerable<IPlayer> — An enumerable collection of SwiftlyS2.Shared.Players.IPlayer instances representing all alive T players currently online.
IsPlayerOnline(int)
Checks whether a specific player is currently online and connected to the server.
bool IsPlayerOnline(int playerid)- playerid int
- bool — True if the player is online, false otherwise.
SendAlert(string)
Sends an alert message to the players.
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 players 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 players.
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 players 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 players.
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 players 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 players.
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 players 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 players.
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 players 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 players.
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 players asynchronously.
Task SendConsoleAsync(string message)- message string — The content of the message to send. Cannot be null.
SendMessage(MessageType, string)
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)- kind MessageType — The type of message display.
- message string — The text content to send to players.
SendMessage(MessageType, string, int)
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)- 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.
SendMessage(MessageType, Func<IPlayer, ILocalizer, string>)
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)- kind MessageType — The type of message display.
- messageCallback Func<IPlayer, ILocalizer, string> — The text callback to send to players.
SendMessage(MessageType, Func<IPlayer, ILocalizer, string>, int)
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)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- messageCallback Func<IPlayer, ILocalizer, string> — The callback 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 players 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 players 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.
SendMessageAsync(MessageType, Func<IPlayer, ILocalizer, string>)
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)- kind MessageType — The type of message display.
- messageCallback Func<IPlayer, ILocalizer, string> — The text callback to send to players.
SendMessageAsync(MessageType, Func<IPlayer, ILocalizer, string>, int)
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)- kind MessageType — The type of message to send. Determines how the message is processed or displayed.
- messageCallback Func<IPlayer, ILocalizer, string> — The callback 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 players.
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 players asynchronously.
Task SendNotifyAsync(string message)- message string — The content of the message to send. Cannot be null.
ShouldBlockTransmitEntity(int, bool)
Controls whether a specific entity should be blocked from being transmitted/synchronized to clients.
void ShouldBlockTransmitEntity(int entityid, bool shouldBlockTransmit)