Checking if player near prop.

[lua]
function GM:Think( )

//Not enough players
if ( #player.GetAll( ) < 2 ) then 
	self:SetPhase( PHASE_WAITING )
return end

//Game over
if ( GetPhaseTable( ):GetType( ) == "Fight" && GAMEMODE:CheckGameEnd( ) ) then
	GAMEMODE:AdvancePhase( ) 
end
if GetPhaseTable( ):GetType( ) == "Fight" then
	for np, p in pairs( player.GetAll( ) ) do
		for k,v in pairs(ents.FindInSphere(p:GetPos(),5)) do  
			if ( !v:IsPlayer() and v:GetClass() == "prop_physics" ) then
				if( !p:GetNetworkedString("Owner", p:Nick()) or !table.HasValue(SPropProtection[v:SteamID()], p:SteamID())) then
					p:SetHealth(p:Health() - 5 )
				end
			end
		end
	end
end

end
[/lua]

Go ahead and bash me, I noticed I put a lot of shit wrong. I want to see if the player has prop protection or is the owner of if not then take health away.

What file is this in?

It’s server side code obv. init.lua trying to check if the player owns the prop he is near it a hacky method to see if he is touching a prop.

Yes but is it in a gamemode or not? try changing this to a think hook instead of a gamemode function

It’s the same he is just overriding the Think hook.
[lua]
for _,v in pairs(ents.GetAll()) do
for _,ply in pairs(player.GetAll()) do
if v:GetClass() == “prop_physics” and ply:GetPos():Distance(v:GetPos()) < 300 then – is the only way i can think off
–Explode or something
end
end
end
[/lua]