Connectionclass
A connection, usually to a server or a client.
Constructors1
Showing 1 constructors
protected Connection()
No results match this filter.
Methods13
Showing 13 methods
public float DistanceSquared(Vector3 position)
Calculate the closest distance (squared) to a position based on the Pvs sources from this `Sandbox.Connection`.
| Parameter | Type | Description |
|---|---|---|
| position | Vector3 | — |
float—public bool Down(string action)
Action is currently pressed down for this `Sandbox.Connection`.
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
bool—public static Sandbox.Connection Find(System.Guid id)
Find a `Sandbox.Connection` for a Connection Id.
| Parameter | Type | Description |
|---|---|---|
| id | Guid | — |
public string GetUserData(string key)
| Parameter | Type | Description |
|---|---|---|
| key | string | — |
string—public bool HasInventoryItem(int definitionId)
Check if this connection has a specific inventory item in their Steam Inventory
| Parameter | Type | Description |
|---|---|---|
| definitionId | int | — |
bool—public virtual bool HasPermission(string permission)
Get whether this connection has a specific permission.
| Parameter | Type | Description |
|---|---|---|
| permission | string | — |
bool—public virtual void Kick(string reason)
Kick this `Sandbox.Connection` from the server. Only the host can kick clients.
| Parameter | Type | Description |
|---|---|---|
| reason | string | The reason to display to this client. |
void—public bool Pressed(string action)
Action was pressed for this `Sandbox.Connection` within the current update context.
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
bool—public bool Released(string action)
Action was released for this `Sandbox.Connection` within the current update context.
| Parameter | Type | Description |
|---|---|---|
| action | string | — |
bool—public void SendLog(Sandbox.LogLevel level, string message)
Log a message to the console for this connection.
| Parameter | Type | Description |
|---|---|---|
| level | LogLevel | — |
| message | string | — |
void—public void SendMessage(T t)
Send a message to this connection.
| Parameter | Type | Description |
|---|---|---|
| t | T | — |
void—public System.Threading.Tasks.Task`1<object> SendRequest(T t)
Send a message to this connection, wait for a response
| Parameter | Type | Description |
|---|---|---|
| t | T | — |
Task<object>—public void SendResponse(System.Guid requestId, T t)
Send a response message to this connection.
| Parameter | Type | Description |
|---|---|---|
| requestId | Guid | — |
| t | T | — |
void—No results match this filter.
Properties24
Showing 24 properties
public virtual string Sandbox.Connection.Address { get; set; }
string—public static System.Collections.Generic.IReadOnlyList`1<Sandbox.Connection> Sandbox.Connection.All { get; set; }
A list of connections that are currently on this server. If you're not on a server this will return only one connection (Connection.Local). Some games restrict the connection list - in which case you will get an empty list.
public bool Sandbox.Connection.CanDestroyObjects { get; set; }
Can this connection destroy networked objects they own?
bool—public bool Sandbox.Connection.CanRefreshObjects { get; set; }
Can this connection refresh networked objects that they own?
bool—public bool Sandbox.Connection.CanSpawnObjects { get; set; }
Can this connection spawn networked objects?
bool—public System.DateTimeOffset Sandbox.Connection.ConnectionTime { get; set; }
DateTimeOffset—public string Sandbox.Connection.DisplayName { get; set; }
The player's name but with any potential nicknames or naughty words filtered out. You don't want to be using this in serverside logic really.
string—public Sandbox.Friend Sandbox.Connection.FriendInfo { get; set; }
Steam friend information for this connection. This is not available on the dedicated server.
public static Sandbox.Connection Sandbox.Connection.Host { get; set; }
The connection of the current network host.
public System.Guid Sandbox.Connection.Id { get; set; }
This connection's unique identifier.
Guid—public bool Sandbox.Connection.IsActive { get; set; }
True if this channel is fully connnected and fully logged on.
bool—public bool Sandbox.Connection.IsConnecting { get; set; }
True if this channel is still currently connecting.
bool—public virtual bool Sandbox.Connection.IsHost { get; set; }
bool—public virtual float Sandbox.Connection.Latency { get; set; }
float—public static Sandbox.Connection Sandbox.Connection.Local { get; set; }
This is a "fake" connection for the local player. It is passed to RPCs when calling them locally etc.
public int Sandbox.Connection.MessagesRecieved { get; set; }
How many messages have been received from this connection?
int—public int Sandbox.Connection.MessagesSent { get; set; }
How many messages have been sent to this connection?
int—public string Sandbox.Connection.Name { get; set; }
The player's name.
string—public Sandbox.SteamId Sandbox.Connection.OwnerSteamId { get; set; }
The SteamID of the account that actually owns the game in a Steam Family. If not in a Steam Family this is the same as `Sandbox.Connection.SteamId`
Note
This is only valid on the host.
public Sandbox.SteamId Sandbox.Connection.PartyId { get; set; }
The Id of the party that this user is a part of. This can be used to compare to other users to group them into parties.
public float Sandbox.Connection.Ping { get; set; }
The ping of this connection (in milliseconds.)
float—public virtual Sandbox.Network.ConnectionStats Sandbox.Connection.Stats { get; set; }
Get stats about this connection such as bandwidth usage and how many packets are being sent and received.
public Sandbox.SteamId Sandbox.Connection.SteamId { get; set; }
public virtual float Sandbox.Connection.Time { get; set; }
float—No results match this filter.