I need help with my Antiblocksystem.

I need help with my Antiblockystem

I’ve tried to make a script which disables the player collision in certain areas. But the problem is i want the players who aren’t in these areas to have a normal collision.
This is the code i got.


local nextCheck = CurTime()+2,5
hook.Add("Think","CheckBox",function()
	if nextCheck <= CurTime() then
		nextCheck = CurTime()+2,5

		local AntiBlockZones = {
			Spawn = ents.FindInSphere(Vector(-4859, 5375, 164),450),
			TeleporterA = ents.FindInSphere(Vector(3585, -5631, 256),450),
			TeleporterB = ents.FindInSphere(Vector(-5632, -5632, 228),450),
			TeleporterC = ents.FindInSphere(Vector(4926, 9095, 127),450),
			TeleporterD = ents.FindInSphere(Vector(4447, 10112, 232),450),
			TeleporterE = ents.FindInSphere(Vector(-4742, 406, 234),450)}

			for k,zones in pairs(AntiBlockZones) do
				for k,plyinzone in pairs(zones)do
					if IsValid(ply) and ply:IsPlayer() and ply:Alive() then
						plyinzone:SetAvoidPlayers(true)
						plyinzone:SetNoCollideWithTeammates(true)
						plyinzone:SetCollisionGroup(11)
					else
						for k,ply in pairs(player.GetHumans()) do
						ply:SetCollisionGroup(0)
						ply:SetAvoidPlayers(false)
						ply:SetNoCollideWithTeammates(false)
						--plyinzone:SetAvoidPlayers(true)
						--plyinzone:SetNoCollideWithTeammates(true)
						--plyinzone:SetCollisionGroup(11)
					end
				end
			end
		end
	end
end)

I’ve commented some of the code, that’s because it gives the error nil.

You could create a brush entity for that.



StartTouch > SetNoCollideWithTeammates(false)
EndTouch > SetNoCollideWithTeammates(true)


Take a look at this post: http://forum.facepunch.com/showthread.php?t=1171555&p=35220153&viewfull=1#post35220153

Is there some other way to do it? Because i really have no glue how to do it that way.

You can enable

Entity:SetCustomCollisionCheck on players, then check if they are in the area in

GM:ShouldCollide