Custom spawn points

Hi. I’m making a gamemode, combine vs rebels, and I want combine to spawn on info_combine_spawn (it’s a custom entity naturally) and rebels on info_rebel_spawn. How do I do this?

[lua]hook.Add(“PlayerSpawn”,“SetSpawn”,function(ply)
if ply:Team() == TEAM_COMBINE then
ply:SetPos(table.Random(ents.FindByClass(“info_combine_spawn”)):GetPos())
elseif ply:Team() == TEAM_REBEL then
ply:SetPos(table.Random(ents.FindByClass(“info_rebel_spawn”)):GetPos())
end
end)[/lua]

Something like that, I think. You would need to substitute however you detect for the player’s team with your own method, though.

Why not just set a spawnpoint for a specific map using the Vector and Angle positions?

It would be too long and boring

It doesn’t work, I always spawn out of the map.

What are you doing? You should be using PlayerSelectSpawn…

I made this
[lua]function GM:PlayerSelectSpawn( ply )
if ply:Team() == 1 then
local spawns = ents.FindByClass( “info_combine_spawn” )
local random_entry = math.random(#spawns)

	return spawns[random_entry] end
if ply:Team() == 1 then
	local spawns = ents.FindByClass( "info_rebel_spawn" )
	local random_entry = math.random(#spawns)
 
	return spawns[random_entry] end

end[/lua]

but i still spawn out of the map. i checked the map, and all the points have the right names. so I am thinking, maybe the spawn points are not compiled because they are obsolete entities? and, do I need to give them a name? because they don’t have names.

As I said over steam make sure you have created the point entities in your entities folder.

info_combine_spawn and info_rebel_spawn are entities from HL2:DM. Use something else.

they aren’t