Skip to content

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. The point is remembered until the next SetSpawnInfo; respawns after a death use it too.

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)

boolean - false when not connected

local RED_TEAM_OUTFIT = "52169773-0c2b-407a-a123-8b403e224718" -- UC_HenryTrosky, a clothing preset GUID
local 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 true
end

SpawnPlayer · OnPlayerRequestSpawn · GetDefaultSpawn · AddSpawnPoint · the Players group of the index