Player
A connected player. Methods run on the server; the player's game follows.
A connected player. Methods run on the server; the player's game follows. You get players from Gamemode events and Gamemode.Players.
Identity#
int Id · string Name#
Session id (unique while the server runs) and the name chosen in the launcher. If two players pick the same name, the server adds a number.
bool IsConnected · bool IsSpawned#
Whether the player is still on the server, and whether their character is in the world.
Position#
Vector3 Position { get; set; } · float Heading#
World position in metres (Y is up) and facing in degrees. Setting Position teleports the character; it's ignored while the player isn't spawned.
Control#
void Spawn(Spawn spawn)#
Places the character in the world and gives control to the player. Spawn.Default uses the server's spawn points; Spawn.At(position, heading) places them at a fixed point on the ground. Does nothing if they're already spawned.
void Freeze() · void Unfreeze() · bool IsFrozen#
Stops or restores the player's movement and game input. A panel also blocks game input while it's open.
void Toast(string text, ToastKind kind = ToastKind.Info)#
Shows a short message in the top right of the player's screen. Kinds: Info, Success, Warning, Error. See the toasts in the UI kit.
void Message(string text)#
Sends a chat line to this player only.
void Kick(string reason)#
Shows the reason to the player and disconnects them.
string SetName(string name)#
Changes the player's name, e.g. to their account name after sign-in (v0.2). The server keeps names valid and unique (adding a number if needed) and returns the name it set.
HUD and wanted level#
PlayerHud Hud · PlayerWanted Wanted#
The player's HUD (money, strips, timers, GPS waypoint) and wanted level (v0.3). See HUD and wanted level.
Camera#
PlayerCamera Camera#
Fly-overs, a flight down to a point, and the normal camera (v0.2). See Camera.