SetSpawnInfo
Where and as what the player’s next spawn happens.
Sets the point and the outfit for the next SpawnPlayer or the spawn that follows OnPlayerRequestSpawn. The
presets are GUIDs from the game’s tables - clothing presets and
weapon presets; "" or nil keeps the server’s [spawn] defaults. appearance is the soul
whose face and body the other players see on this player’s body - a soul of the NPC or NPC_Female archetype from
the souls by name, id or GUID; "" picks one from the server’s [spawn] appearances pool by the
player’s name, so a player looks the same every visit. A look chosen part by part - the face, the hair, the beard, the
skin - is SetPlayerLook’s: its parts replace the soul’s on every screen. The point is remembered until the next
SetSpawnInfo; respawns after a death use it too. The bag is emptied and the outfit put on at a player’s first spawn of a
visit and at any spawn whose two presets differ from the spawn before (the purse the server holds for them stays); a
respawn with the same presets keeps what they carry, so the outfit is the mode’s to change by presets or by
SetPlayerInventory.
Syntax
Section titled “Syntax”SetSpawnInfo(pid, x, y, z, yaw [, clothingPreset, weaponPreset, appearance])| Parameter | Type | |
|---|---|---|
pid |
number | the player |
x |
number | metres |
y |
number | metres |
z |
number | metres; below 0 = on the terrain |
yaw |
number | degrees to face (0 without) |
clothingPreset |
string | a clothing preset GUID; "" = the server default (optional) |
weaponPreset |
string | a weapon preset GUID; "" = the server default (optional) |
appearance |
string | the soul whose face the others see (name, id or GUID); "" = the server’s pool (optional) |
Returns
Section titled “Returns”boolean - false when not connected
Example
Section titled “Example”local RED_TEAM_OUTFIT = "52169773-0c2b-407a-a123-8b403e224718" -- UC_HenryTrosky, a clothing preset GUIDlocal LONGSWORD = "00928214-01bb-452f-b322-724cffe6ebdc" -- longsword_5_01, a weapon preset GUID
function OnPlayerRequestSpawn(pid) local x, y, z, yaw = GetRandomSpawnPoint("red") SetSpawnInfo(pid, x, y, z, yaw, RED_TEAM_OUTFIT, LONGSWORD, "test_cuman_ai") return trueendSee also
Section titled “See also”SpawnPlayer · OnPlayerRequestSpawn · GetDefaultSpawn · AddSpawnPoint · SetPlayerLook · the Players group of the index
