The sourcemod.clients module contains functions and objects having to do with clients. There may be different functions available in this module than SourceMod’s clients.inc, because they fit in better here.
These flags will be used in the clients.Client.ban() function, which is yet to be implemented.
| Flag | Description |
|---|---|
|
Auto-detects whether to ban by steamid or IP |
|
Always ban by IP |
|
Always ban by authstring (Steam ID) if possible |
|
Does not kick the client |
Use COMMAND_FILTER flags with process_target_string to filter the players that will be chosen.
| Flag | Description |
|---|---|
|
Only allow alive players |
|
Only filter dead players |
|
Allow players not fully in-game |
|
Ignore immunity rules |
|
Do not allow multiple target patterns |
|
Do not allow bots to be targetted |
The tuple process_target_string returns contains a reason field, which will be one of the constants below. These describe the reason why process_target_string failed or succeeded. For implementation purposes, reason values larger than 0 succeeded, a value of 0 means no player was matched, and anything below 0 means players were found, but they didn’t meet the COMMAND_FILTER flags passed.
| Flag | Description |
|---|---|
|
Client passed the filter. The value of this flag is 1. |
|
No target was found. The value of this flag is 0. The rest of the flags’ values continue to decline by 1. |
|
Single client is not alive |
|
Single client is not dead |
|
Single client is not in game |
|
Single client is immune |
|
A multi-filter (such as @all) had no targets |
|
Target was not human |
|
Partial name had too many targets |
Creates a fake client.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | A valid clients.Client object on success, None otherwise. |
Retrieves the clients.Client object with that client index.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | A valid clients.Client object on success, None if an invalid client index. |
Returns the number of clients put in the server.
| Parameters: |
|
|---|---|
| Return type: | int |
Retrieves a clients.Client object by their serial number.
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | A valid clients.Client object on success, None if an invalid client serial. |
Translates a userid index into a clients.Client object
| Parameters: |
|
|---|---|
| Return type: | |
| Returns: | A valid clients.Client object on success, None if an invalid userid. |
Returns the maximum number of clients allowed on the server. This may return 0 if called before the global forward on_map_start.
Processes a generic target string and resolves it to a list of clients, or one client, based on filtering rules.
This function returns a tuple containing all the useful data: (targets, target_name, target_name_is_multilingual, reason)
Returning a tuple allows easier handling of the data:
targets,target_name,tn_is_ml,reason = process_target_string("@all", 2, COMMAND_FILTER_ALIVE|COMMAND_FILTER_CONNECTED)
| Parameters: |
|
|---|
Client objects cannot be instantiated by themselves. Instead, use get_client(index) to retrieve a client object.
Bans the client. time is the time, in minutes, to ban the client (0 = permanent).
flags is a bitstring of BANFLAG flags that will control the banning mechanism. If BANFLAG_AUTHID is set and no auth ID is available, the ban will fail, unless BANFLAG_AUTO is also set.
reason is a string containing the reason for banning the client. kickmsg is the message to display to the player when they’re kicked.
cmd is a string containing the command used to initiate the ban in order to identify the source. If this is left empty, then the ban_client forward will not be called. source is a value that could be interpreted as the identity of the player whom was the source of the banning (not actually checked by Core).
This returns True if the player was successfully banned, and False otherwise (the only case False is returned is mentioned above in the explanation of flags).
Executes a client command on the server without being networked.
| Parameters: |
|
|---|
Returns whether the client is connected.
Returns whether the client is timing out.
Disconnects a player from the server.
| Parameters: |
|
|---|---|
| Return type: | bool |
| Returns: | True on successful kick, False if the player is already in the kick queue. |
Signals that a player has completed post-connection admin checks. Has no effect if the player has already had this event signalled. Note: This must be sent even if no admin id was assigned.
Prints a message to this client in the center of the screen.
| Parameters: |
|
|---|
Prints a message to this client’s chat area.
| Parameters: |
|
|---|
Prints a message to this client’s console.
| Parameters: |
|
|---|
Prints a message to this client inside a hint box.
| Parameters: |
|
|---|
Sets a convar value on a fake client.
| Parameters: |
|
|---|
Show a VGUI panel to the client.
| Parameters: |
|
|---|
A number containing the index of the client. This is what SourcePawn uses for handling clients.
The client’s angles vector.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s origin vector.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
Whether the client is alive or dead.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s average packet choke. Value is a percentage ranging from 0.0 to 1.0
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average incoming packet choke. Value is a percentage ranging from 0.0 to 1.0.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average outgoing packet choke. Value is a percentage ranging from 0.0 to 1.0.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s data flow, incoming and outgoing, in bytes per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s incoming data flow in bytes per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s outgoing data flow in bytes per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s average packet latency, both incoming and outgoing, in seconds.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average incoming packet latency in seconds.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average outgoing packet latency in seconds.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average packet loss. Value is a percentage ranging from 0.0 to 1.0.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average incoming packet loss. Value is a percentage ranging from 0.0 to 1.0.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average outgoing packet loss. Value is a percentage ranging from 0.0 to 1.0.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average packet frequency, incoming and outgoing, in packets per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average incoming packet frequency, in packets per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s average outgoing packet frequency, in packets per second.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s send date rate in bytes per second
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The player’s death count.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The Entity of the Client.
Whether the client is fake or not.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The player’s frag count.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The health of the player.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The IP address of this client.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The client’s language ID as an int.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The client’s packet latency (RTT), both incoming and outgoing, in seconds. This is more accurate than the average latency, but jittery.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s incoming packet latency (RTT) in seconds. This is more accurate than the average latency, but jittery.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s outgoing packet latency (RTT) in seconds. This is more accurate than the average latency, but jittery.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The client’s max size vector.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s min size vector.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The client’s model name.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |
The name of this client.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The client’s unique serial identifier.
The Steam ID of this client. This is None when the client is not authorized, yet.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The player’s team.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, no mod support, or client not in-game. | |
The amount of time the client has been connected in seconds.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or client is a fake client. | |
The userid of this client.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client or client not connected. | |
The player’s weapon name.
| Raises sourcemod.ViperError: | |
|---|---|
| Invalid client, client not in-game, or no mod support. | |