Skip to content

GetRandomSpawnPoint

One spawn point of a tag, at random.

GetRandomSpawnPoint([tag])
Parameter Type
tag string the list ("" without) (optional)

number, number, number, number - a point as x, y, z, yaw; nil when the list is empty

function OnPlayerRequestSpawn(pid)
local x, y, z, yaw = GetRandomSpawnPoint(GetPlayerData(pid, "team") or "red")
if x then SetSpawnInfo(pid, x, y, z, yaw) end
return true
end

AddSpawnPoint · SetSpawnInfo · the Players group of the index