Skip to content

SpawnPlayer

Spawns - or respawns - the player at their SetSpawnInfo point.

Puts a player whose level is loaded into the world at the point SetSpawnInfo set (the server’s default without one), or moves and re-outfits one who already is; OnPlayerSpawn follows. The way to release a player held by OnPlayerRequestSpawn returning false, and to respawn the dead when [combat] respawn_seconds is 0. A spawn heals: full health and stamina, injuries and the server’s buffs gone.

SpawnPlayer(pid)
Parameter Type
pid number the player

boolean - false when not connected

-- a lobby: hold everyone, release them when the round starts
function OnPlayerRequestSpawn(pid)
waiting[#waiting + 1] = pid
return false
end
local function startRound()
for _, pid in ipairs(waiting) do
SetSpawnInfo(pid, GetRandomSpawnPoint("arena"))
SpawnPlayer(pid)
end
waiting = {}
end

SetSpawnInfo · OnPlayerRequestSpawn · OnPlayerSpawn · OnPlayerDeath · the Players group of the index