Skip to content

Spawns

This page documents the hooks defined by the spawns module.


GetPlayerRespawnLocation(client, character)View Source

Purpose

Allows code to provide a custom respawn location before the spawn module falls back to its normal selection logic.

Realm

Server

Parameters

Player client The player who is respawning.

Character character The player's active character.

Returns

table|nil Return a table containing `pos` or `position`, and optionally `ang` or `angle`, to override the respawn location.


GetPlayerSpawnLocation(client, character)View Source

Purpose

Allows code to provide a custom spawn location for normal character spawns.

Realm

Server

Parameters

Player client The player who is spawning.

Character character The player's active character.

Returns

table|nil Return a table containing `pos` or `position`, and optionally `ang` or `angle`, to override the spawn location.


OnRespawnKeyPressed(ply, key, left, baseTime, lastDeath)View Source

Purpose

Called on the client when a key is pressed while the respawn screen is active.

Realm

Client

Parameters

Player ply The local player using the respawn screen.

number key The pressed key code.

number left The remaining time before respawn becomes available.

number baseTime The configured base respawn delay.

number lastDeath The timestamp of the player's last death.

Returns

boolean|nil Return false to block the default respawn-screen key handling.


PlayerSpawnPointSelected(client, position, angle)View Source

Purpose

Called after the spawn module selects a final spawn point for a player.

Realm

Server

Parameters

Player client The player being placed at the spawn point.

Vector position The final position chosen for the spawn.

Angle angle The eye angle applied to the player at spawn.


ShouldRespawnScreenAppear(ply, left, baseTime, lastDeath)View Source

Purpose

Determines whether the clientside respawn screen should be shown.

Realm

Client

Parameters

Player ply The local player who died.

number left The remaining time before respawn becomes available.

number baseTime The configured base respawn delay.

number lastDeath The timestamp of the player's last death.

Returns

boolean|nil Return false to suppress the respawn screen.


ShouldUseMapSpawns(client, character, isRespawning)View Source

Purpose

Determines whether the spawn module should prefer map-defined spawn entities before its usual class or faction spawn logic.

Realm

Server

Parameters

Player client The player being spawned.

Character character The player's active character.

boolean isRespawning Whether this spawn is a respawn rather than an initial spawn.

Returns

boolean|nil Return true to force use of map spawn entities first.