Prophunt spawns and random deaths

I have a prophunt server and people are spawning on random spots like hunters at props and props at hunters (all mixed) map : cs_office
also people die randomly because there aren’t enough spawnpoints. I’d appreciate it if someone could fix this for me.

  1. post your shared.lua of Prop Hunt

  2. Either get someone to make you a script that allows you to put extra spawn points in the map or decompile the map, open it via hammer and manually add more spawn points in. Actually another alternative, if you’re using the version on Fretta, you could do a check on the OnRoundStart function to check if players are dead and then to respawn them.

Without looking further into the problem, my best guess would be this code (found in the base gamemode) :
[lua]function GM:IsSpawnpointSuitable( pl, spawnpointent, bMakeSuitable )

local Pos = spawnpointent:GetPos()

-- Note that we're searching the default hull size here for a player in the way of our spawning.
-- This seems pretty rough, seeing as our player's hull could be different.. but it should do the job
-- (HL2DM kills everything within a 128 unit radius)
local Ents = ents.FindInBox( Pos + Vector( -16, -16, 0 ), Pos + Vector( 16, 16, 64 ) )

if ( pl:Team() == TEAM_SPECTATOR ) then return true end

local Blockers = 0

for k, v in pairs( Ents ) do
	if ( IsValid( v ) && v:GetClass() == "player" && v:Alive() ) then
	
		Blockers = Blockers + 1
		
		if ( bMakeSuitable ) then
			v:Kill()
		end
		
	end
end

if ( bMakeSuitable ) then return true end
if ( Blockers > 0 ) then return false end
return true

end
[/lua]

Just overwrite this function to replicate functionality but minus the killing.

That is the function that causes it, and you’ll get weird side effects if you remove the v:Kill() , players will “steal” grenades from other players if they spawn on each other ;D

There’s 2 methods that works depending on your situation…

  1. Edit the function that calls this function to try and find a spawn in more repetitions (only really works if your map has enough spawns for amount of players)
  2. Add more spawns manually with EntSpy

Or just keep on spawning them until it works.

[lua]
function GM:IsSpawnpointSuitable( pl, spawnpointent, bMakeSuitable )

local Pos = spawnpointent:GetPos()

local Ents = ents.FindInBox( Pos + Vector( -16, -16, 0 ), Pos + Vector( 16, 16, 64 ) )

if ( pl:Team() == TEAM_SPECTATOR ) then return true end

for k, v in pairs( Ents ) do
	if ( IsValid( v ) && v:GetClass() == "player" && v:Alive() ) then
		
		if ( bMakeSuitable ) then
			v:Kill()
			v:Spawn()
		end
		
		return false			
		
	end
end

if ( bMakeSuitable ) then return true end
return true

end
[/lua]

Untested, should keep on spawning them until it works. There are a few problems you will have to deal with (such as if the weapon drops it’s self upon death, and score systems).