Skip to content

Spawns

This page documents hooks in the spawns category.


FetchSpawns()View Source

Purpose

Loads the stored faction spawn table and normalizes saved entries into structured spawn data.

Category

Spawns

Realm

Server

Returns

Deferred Resolves with the normalized faction spawn table.

Example Usage

  hook.Add("FetchSpawns", "liaExampleFetchSpawns", function()
      print("[MyModule] handled FetchSpawns")
  end)

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.

Category

Spawns

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.

Example Usage

  hook.Add("GetPlayerRespawnLocation", "liaExampleGetPlayerRespawnLocation", function(client, character)
      return {
          {name = "Example", value = 1}
      }
  end)

GetPlayerSpawnLocation(client, character)View Source

Purpose

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

Category

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.

Example Usage

  hook.Add("GetPlayerSpawnLocation", "liaExampleGetPlayerSpawnLocation", function(client, character)
      return {
          {name = "Example", value = 1}
      }
  end)

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

Purpose

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

Category

Spawns

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.

Example Usage

  hook.Add("OnRespawnKeyPressed", "liaExampleOnRespawnKeyPressed", function(ply, key, left, baseTime, lastDeath)
      if IsValid(ply) and ply:IsAdmin() then
          return true
      end
  end)

PlayerSpawnPointSelected(client, position, angle)View Source

Purpose

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

Category

Spawns

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.

Example Usage

  hook.Add("PlayerSpawnPointSelected", "liaExamplePlayerSpawnPointSelected", function(client, position, angle)
      if not IsValid(client) then return end
      print(string.format("[MyModule] handled PlayerSpawnPointSelected for %s", client:Name()))
  end)

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

Purpose

Determines whether the clientside respawn screen should be shown.

Category

Spawns

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.

Example Usage

  hook.Add("ShouldRespawnScreenAppear", "liaExampleShouldRespawnScreenAppear", function(ply, left, baseTime, lastDeath)
      if IsValid(ply) and ply:IsAdmin() then
          return true
      end
  end)

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.

Category

Spawns

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.

Example Usage

  hook.Add("ShouldUseMapSpawns", "liaExampleShouldUseMapSpawns", function(client, character, isRespawning)
      if IsValid(client) and client:IsAdmin() then
          return true
      end
  end)

StoreSpawns(spawns)View Source

Purpose

Saves the provided faction spawn table into persistent module data.

Category

Spawns

Realm

Server

Parameters

table spawns The faction spawn data to persist.

Returns

Deferred Resolves true after the spawn data is queued for persistence.

Example Usage

  hook.Add("StoreSpawns", "liaExampleStoreSpawns", function(spawns)
      print("[MyModule] handled StoreSpawns")
  end)