Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hook.Add("SetupMove", "DevCorner.SetupMove", function(p, d)
- if DevCorner.HasDevAccess(p) then return end -- Ignore people with access
- local v = d:GetVelocity()
- local o = d:GetOrigin()
- local od = math.abs((o - DevCorner.WallPos):Dot(Vector(1, 0, 0))) -- Distance to the plane
- local vd = v:Dot(Vector(1, 0, 0))
- -- Within 70 units, stop them.
- if od < 70 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
- p.devbpos = p.devbpos or o
- d:SetOrigin(p.devbpos)
- d:SetVelocity(Vector(0, v.y, v.z))
- p.devbpos = p.devbpos + Vector(0, v.y, v.z) / 90
- else
- p.devbpos = nil
- end
- -- Within 50 units, push them out.
- if od < 50 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
- d:SetVelocity(d:GetVelocity() - Vector(200, 0, 0))
- end
- end)
- hook.Add("Move", "DevCorner.Move", function(p, d)
- if DevCorner.HasDevAccess(p) then return end -- Ignore people with access
- local v = d:GetVelocity()
- local o = d:GetOrigin()
- local od = math.abs((o - DevCorner.WallPos):Dot(Vector(1, 0, 0))) -- Distance to the plane
- local vd = v:Dot(Vector(1, 0, 0))
- -- Within 70 units, stop them.
- if od < 70 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
- local nv = Vector(0, v.y, v.z)
- d:SetVelocity(nv)
- end
- -- Within 50 units, push them out.
- if od < 50 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
- d:SetVelocity(d:GetVelocity() - Vector(200, 0, 0))
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment