Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classServer APIGenerated

BasePlayer

Defined in: server/api.d.ts:9959

Framework-owned base handle for a connected player, extended by each game or mod.

new BasePlayer(id): BasePlayer

Defined in: server/api.d.ts:9964

Creates a wrapper for an existing connected player with this ID; it does not connect or spawn a player.

number

Network entity identifier.

BasePlayer

Entity.constructor

emit(eventName, payloadJson?): void

Defined in: server/api.d.ts:10042

Emits a named script event to this player’s client connection.

string

Client event name.

string

Optional JSON payload forwarded verbatim to the owning client.

void


getIP(): string

Defined in: server/api.d.ts:10048

Returns this player’s current remote network address.

string

Address string, or an empty string when the player or peer is unavailable.


getNametagColor(): number

Defined in: server/api.d.ts:10029

Reads this player’s nametag color.

number

Packed 0xAARRGGBB color; opaque white when untinted.


getNametagText(): string

Defined in: server/api.d.ts:10023

Reads this player’s nametag text override.

string

The override, or an empty string when the player’s own name is drawn.


isNametagHealthVisible(): boolean

Defined in: server/api.d.ts:10017

Checks whether the health bar under this player’s nametag is shown.

boolean

True unless the health bar was hidden; false also when this game has no nametags.


isNametagVisible(): boolean

Defined in: server/api.d.ts:10011

Checks whether this player’s nametag is shown to other players.

boolean

True unless the nametag was hidden; false also when this game has no nametags.


kick(reason?): void

Defined in: server/api.d.ts:10035

Disconnects this player from the server.

string

Optional reason shown to the disconnected player; omitting it uses the generic kicked reason.

void


setNametagColor(color): void

Defined in: server/api.d.ts:10072

Tints the text on this player’s nametag.

number

Packed 0xAARRGGBB color.

void


setNametagHealthVisible(visible): void

Defined in: server/api.d.ts:10060

Shows or hides the health bar under this player’s nametag, leaving the name itself alone.

boolean

True to show the health bar under this player’s name, false to hide it.

void


setNametagText(text?): void

Defined in: server/api.d.ts:10066

Overrides the text drawn on this player’s nametag.

string

Text to show instead of the player’s name, cut to 64 bytes; empty or omitted restores the name.

void


setNametagVisible(visible): void

Defined in: server/api.d.ts:10054

Shows or hides the name over this player’s head for every other player. The health bar has its own switch, and each player can still hide all nametags locally.

boolean

True to show this player’s nametag to everyone, false to hide it.

void


setVirtualWorld(world): void

Defined in: server/api.d.ts:9890

Moves this entity into another virtual world.

number

Virtual-world identifier used to partition replication and visibility.

void

Entity.setVirtualWorld


setVisibleTo(player): void

Defined in: server/api.d.ts:9896

Restricts replication of this entity to one owning connection while preserving normal range and visibility checks.

Entity | null

Player-owned entity whose connection should exclusively receive this entity, or null to clear the restriction.

void

Entity.setVisibleTo


toString(): string

Defined in: server/api.d.ts:10005

Formats this player handle for logging and debugging.

string

Text containing the player’s network entity ID.

Entity.toString

readonly discordId: string

Defined in: server/api.d.ts:9979

Authenticated Discord identifier, or an empty string when unavailable.


readonly discordName: string

Defined in: server/api.d.ts:9984

Discord username the client reported, not verified by the server, or an empty string when unavailable.


readonly epicId: string

Defined in: server/api.d.ts:9974

Epic Games account identifier the client reported, not verified by the server, or an empty string when unavailable.


readonly hardwareId: string

Defined in: server/api.d.ts:9989

Framework hardware identifier, or an empty string when unavailable.


readonly id: number

Defined in: server/api.d.ts:9858

Immutable network entity identifier.

Entity.id


readonly ip: string

Defined in: server/api.d.ts:9999

Current remote network address, or an empty string when unavailable.


readonly ping: number

Defined in: server/api.d.ts:9994

Current round-trip latency in milliseconds, or -1 when unavailable.


position: Vector3

Defined in: server/api.d.ts:9868

Authoritative world-space position; assignment forces replicated state.

Entity.position


rotation: Vector3 | Quaternion

Defined in: server/api.d.ts:9873

Authoritative rotation; reads return a quaternion and assignments accept a quaternion or Euler angles in degrees.

Entity.rotation


readonly state: StateBag

Defined in: server/api.d.ts:9878

Arbitrary key/value state carried by this entity. The server writes it and every client that can see the entity receives it; see StateBag.

Entity.state


readonly steamId: string

Defined in: server/api.d.ts:9969

Authenticated Steam identifier, or an empty string when unavailable.


readonly virtualWorld: number

Defined in: server/api.d.ts:9863

Current virtual-world identifier.

Entity.virtualWorld