Prevent Surfing?

On one of the maps for my gamemode, people can cheat and surf to get to the end, but I need to prevent that.

This was my attempt, but sometimes it triggers when they are jumping too.



function preventSurf(ply, movedata)
	if !ply:Alive() then
		return false
	end

	if ply:IsOnGround() then
		ply.isSurfing = false
		return false
	end
	
	if movedata:GetVelocity( ).z <= 0 then
		ply.isSurfing = false
		return false
	end
	
	if movedata:GetVelocity( ).z > 50 then
		ply.isSurfing = false
		return false
	end
	
	if ply.isSurfing then
		return false
	end
	
	

	ply.isSurfing = true
	timer.Simple( 8, function()
		if ply:GetVelocity().z < 50 and ply:GetVelocity().z > 0 and ply.isSurfing then
			ply:KillSilent()

			ply:ChatPrint("Surfing is Prohibited!")
			ply.isSurfing = false
			return true
		end
	end)
	
	return false

end

hook.Add("Move", "Prevent Surfing", preventSurf)



Why don’t you just block the surfable zone…?

put playerclip brushes on the slanted wall so it looks the same, but you cant go onto it.

Its not his map, he said on one of hte maps for my gamemode, it might be a random map, just for his gamemode.

Ever thought of getting the surface normal of whatever the player is running on? And do stuff when it’s too steep.

Which part of the trace.HitNormal:Angle() would I compare to, and how much?

Get ‘Falco Prop Protection’

Click here

It has an anti-surf feature.

[lua]function preventSurf(ply, movedata)
if !ply:Alive() then
return false
end

if ply:IsOnGround() then
	ply.isSurfing = false
	return false
end

if movedata:GetVelocity( ).z &lt;= 0 then
	ply.isSurfing = false
	return false
end

if movedata:GetVelocity( ).z &gt; 50 then
	ply.isSurfing = false
	return false
end

if ply.isSurfing then
	return false
end



ply.isSurfing = true
local x = 0
while ply:GetVelocity().z &lt; 50 and ply:GetVelocity().z &gt; 10 and ply.isSurfing do
	if x &gt;= 8 then
		ply:KillSilent()

		ply:ChatPrint("Surfing is Prohibited!")
		ply.isSurfing = false
		return true
	end
	x += 1
end

return false

end

hook.Add(“Move”, “Prevent Surfing”, preventSurf)[/lua]

This maybe?

Oh I apologize, I didn’t mean prop surfing, I meant CSS-style surfing, along the map.

place in the init.lua
[lua]CreateClientConVar(“gm_spawn”,“BlOCKED”, true,true)[/lua]

That… has nothing to do with this thread…

He said Prevent Surfing Dumbo so if people spawning props and using physgun because he didn’t say what weapons are included so your the biggest idiot in the forum, skiddie.

That was a dumb attempt to cover up your stupidity. As for the prop surfing, how about making it so if the prop isn’t frozen by the physics gun, players can go through it?

I remember seeing a function that checks if a player is phsygunning or gravgunning a prop maybe you could check if that’s true and then if it is check if the player is standing on it or if the props velocity is moving fast make it take 0 gravity so it wont kill anyone when released.

Also ecabc I don’t know what your problem is but from what I can tell you need to get over yourself and realize your not the god of the lua section…

[editline]03:54PM[/editline]

I though those maps had to be made to surf on tho :confused:

Lets get this straight you have a gamemode that doesn’t want people to be able to surf on the map, and your playing on a surf map tho? what map is it anyway.

Why not just nocollide the player’s prop with the player while they are holding it with the physics gun?

/me facepalm

He allready said its not propsurfing he is dealing with.

Nor are you…

Like how Sassilization prevent surfing on XC_egypt.

Ohh, you can kill them after soo many seconds like if there surfing making it trigger hurt.

There’s your answer if he’s talking about prop surfing, but I think he said CSS surfing whatever that is.