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.
Syntax
Section titled “Syntax”SpawnPlayer(pid)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”-- a lobby: hold everyone, release them when the round startsfunction OnPlayerRequestSpawn(pid) waiting[#waiting + 1] = pid return falseend
local function startRound() for _, pid in ipairs(waiting) do SetSpawnInfo(pid, GetRandomSpawnPoint("arena")) SpawnPlayer(pid) end waiting = {}endSee also
Section titled “See also”SetSpawnInfo · OnPlayerRequestSpawn · OnPlayerSpawn · OnPlayerDeath · the Players group of the index
