Python1320

Untitled

Dec 8th, 2010
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. hook.Add("SetupMove", "DevCorner.SetupMove", function(p, d)
  2.         if DevCorner.HasDevAccess(p) then return end -- Ignore people with access
  3.         local v = d:GetVelocity()
  4.        
  5.         local o = d:GetOrigin()
  6.         local od = math.abs((o - DevCorner.WallPos):Dot(Vector(1, 0, 0))) -- Distance to the plane
  7.        
  8.         local vd = v:Dot(Vector(1, 0, 0))
  9.        
  10.         -- Within 70 units, stop them.
  11.         if od < 70 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
  12.             p.devbpos = p.devbpos or o
  13.             d:SetOrigin(p.devbpos)
  14.             d:SetVelocity(Vector(0, v.y, v.z))
  15.             p.devbpos = p.devbpos + Vector(0, v.y, v.z) / 90
  16.         else
  17.             p.devbpos = nil
  18.         end
  19.        
  20.         -- Within 50 units, push them out.
  21.         if od < 50 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
  22.             d:SetVelocity(d:GetVelocity() - Vector(200, 0, 0))
  23.         end
  24.     end)
  25.  
  26.     hook.Add("Move", "DevCorner.Move", function(p, d)
  27.         if DevCorner.HasDevAccess(p) then return end -- Ignore people with access
  28.         local v = d:GetVelocity()
  29.        
  30.         local o = d:GetOrigin()
  31.         local od = math.abs((o - DevCorner.WallPos):Dot(Vector(1, 0, 0))) -- Distance to the plane
  32.        
  33.         local vd = v:Dot(Vector(1, 0, 0))
  34.        
  35.         -- Within 70 units, stop them.
  36.         if od < 70 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
  37.             local nv = Vector(0, v.y, v.z)
  38.             d:SetVelocity(nv)
  39.         end
  40.        
  41.         -- Within 50 units, push them out.
  42.         if od < 50 and o:Distance(DevCorner.WallPos) < 130 and vd > 0 then
  43.             d:SetVelocity(d:GetVelocity() - Vector(200, 0, 0))
  44.         end
  45.     end)
Advertisement
Add Comment
Please, Sign In to add comment