SwiftlyS2

IPlayerManagerService

Interface IPlayerManagerService

Namespace: SwiftlyS2.Shared.Players

Assembly: SwiftlyS2.CS2.dll

public interface IPlayerManagerService

Properties

PlayerCap

Gets the maximum number of players allowed by the engine.

int PlayerCap { get; }
Property Value

PlayerCount

Gets the number of players currently in the game.

int PlayerCount { get; }
Property Value

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)
Parameters
Returns

GetAlive()

Retrieves all alive players currently online.

IEnumerable<IPlayer> GetAlive()
Returns
  • 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()
Returns
  • 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()
Returns
  • 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()
Returns
  • 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()
Returns
  • 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)
Parameters
  • team Team — The team for which to retrieve players.
Returns
  • 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)
Parameters
  • playerid int — The unique identifier of the player to retrieve. Must be a valid player ID.
Returns
  • IPlayer? — An SwiftlyS2.Shared.Players.IPlayer instance representing the player with the specified ID, or null if no such player exists.

GetSpectators()

Retrieves all spectator players currently online.

IEnumerable<IPlayer> GetSpectators()
Returns
  • 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()
Returns
  • 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()
Returns
  • 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)
Parameters
Returns
  • 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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

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)
Parameters
  • 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)
Parameters
  • 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.
Returns

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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

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)
Parameters
  • 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)
Parameters
  • 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)
Parameters

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)
Parameters
  • 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)
Parameters
  • 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.
Returns

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)
Parameters
  • 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.
Returns

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)
Parameters
Returns

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)
Parameters
  • 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.
Returns

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)
Parameters
  • 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)
Parameters
  • message string — The content of the message to send. Cannot be null.
Returns

ShouldBlockTransmitEntity(int, bool)

Controls whether a specific entity should be blocked from being transmitted/synchronized to clients.

void ShouldBlockTransmitEntity(int entityid, bool shouldBlockTransmit)
Parameters
  • entityid int
  • shouldBlockTransmit bool

On this page