People dying on spawn, respawn script and server crash...

Hi,

So I made a fretta based simple gamemode.

On a map, called gm_parallax, many people if not everyone is dying when spawning…

So I tryed to make a work arround which is this :



function GM:PostPlayerDeath( ply )
	if GetGlobalFloat("RoundStartTime",CurTime()) + 20 > CurTime() and (ply:Team() == TEAM_PEDOBEAR or ply:Team() == TEAM_VICTIMS)then
		ply:AddDeaths( -1 )
		ply:Spawn()
	elseif ( ply:GetObserverMode() == OBS_MODE_NONE ) then
		ply:Spectate( OBS_MODE_DEATHCAM )
	end
end


So as you can see, when the player is dead, if the time is below 20 secs then the player respawn.
However, when there is many people on gm_parallax, then players respawn but dies again in some kind of loop and that crashes the server…

On my gamemode I did set the fretta var (CLASS.TeammateNoCollide = true) so people from the same team are no colliding so I guess them spawning on the same spawn point shouldn’t make them die (But maybe I’m wrong ?).
I had spawn points in team.SetSpawnPoint, then I removed them (Because I belive there are choosen randomly from every availlable ones if this isn’t set)

So now I ask for some help. Do you have some kind of ideas of how I could prevent people from dying on spawn ? Because I actualy had more than 30 players on the server when it crashed which is a bit annoying and may make people not comming on it again :<

[editline]20th January 2016[/editline]

As people spawning on the spame spot as other people isn’t an issue, I found that


function GM:IsSpawnpointSuitable( pl, spawnpointent, bMakeSuitable )
	return true
end


Fixed my issues.