Team based spawnpoint?

I was wondering how you spawn a player in a position randomised from a table, do you have to override info_player_start?

[lua]
local spawns = {}

spawns[1] = Vector(1,1,1)

for k,v in pairs(player.GetAll()) do
v:SetPos(table.Random(spawns))
end
[/lua]

Table.Random chooses a random value from the table provided, and SetPos set’s the players position using the vector chosen from the table.

I don’t think that’s what he was aiming for.

I was more aiming for something like this:



local bluespawns = {}
bluespawns[1] = Vector(1,1,1)

local redspawns = {}
redspawns[1] = Vector(1,1,1)

if ply:GetTeam() == 1 then
   -- Do something to make them spawn in a bluespawn vector
else 
if ply:GetTeam() == 2 then
  -- Do something to make them spawn in a redspawn vector.
end



[lua]
local spawnPoints = {
{Vector(), Vector()},
{Vector(), Vector()}
}

local teamSpawnPoint = spawnPoints[ply:Team()]
if teamSpawnPoint then
ply:SetPos(table.Random(teamSpawnPoint))
end
[/lua]