Constructor
new Players(server)
- Source:
Properties:
Name | Type | Description |
---|---|---|
server |
object | The server this belongs to. |
players |
Map | List of players mapped by their ID. |
Parameters:
Name | Type | Description |
---|---|---|
server |
Server | The server this belongs to. |
Methods
broadcast(message)
- Source:
Broadcasts a message to every player's chatbox. Cannot exceed 256 bytes. SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to send. |
broadcastCenterHint(message)
- Source:
Broadcasts a message to a every player's center hint box. Cannot exceed 256 bytes. SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to send. |
broadcastHint(message)
- Source:
Broadcasts a message to a every player's hint box. Cannot exceed 256 bytes. SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
message |
string | The message to send. |
broadcastSound(path)
- Source:
Plays a sound to all players. The file path must be a game sound from scripts/game_sound.txt
or sound_misc_dir.vpk
. Cannot exceed 256 bytes.
SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
path |
string | File path to the sound |
fetch() → {Map}
- Source:
Fetches the list of all players currently connected. Keep in mind that Players.players
will not always be up to date! Use this function to cache the list of players every so often. Similar to Player.fetch()
Returns:
List of all players currently connected, mapped by ID.
- Type
- Map
get(id) → {Object}
- Source:
Gets a player by ID.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The player's ID |
Returns:
- Player object, or
null
if not found.
- Type
- Object
Events
chat
- Source:
Fires when a player sends a chat message. SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
player |
object | The player object who sent this message. Will be partial if not cached. |
message |
string | Content of the chat message. |
team |
bool | True if the chat message was a team message, and false otherwise. |
connect
- Source:
Fires when a player connects to the server. Make sure to fetch with Players.fetch()
before interacting with players.
SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
id |
number | ID of the player, specific to this server. |
name |
string | Username of the player. |
ip |
string | IP address of the player. Will be |
steamid |
string | Steam ID of the player, in SteamID3 format (example: |
bot |
bool | Will be true if this player is a TFBot (or otherwise not a human player), or false if otherwise. |
disconnect
- Source:
Fires when a player disconnects to the server. Make sure to fetch with Players.fetch()
before interacting with players.
SourceMod API Reference
Parameters:
Name | Type | Description |
---|---|---|
id |
number | ID of the player, specific to this server. |
name |
string | Username of the player. |
steamid |
string | Steam ID of the player, in steamID3 format (example: |
reason |
string | Reason for the player disconnecting. (examples: |
bot |
bool | Will be true if this player is a TFBot (or otherwise not a human player), or false if otherwise. |