Advertisement
captmicro

Unknown

Oct 16th, 2010
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.83 KB | None | 0 0
  1. --[[LOLBOT]]--
  2. lolwut = {}
  3. lolwut.lp = LocalPlayer()
  4. lolwut.lastangle = Angle(0,0,0)
  5. lolwut.fakeview = false
  6. lolwut.prefbone = "ValveBiped.Bip01_Head1"
  7.  
  8. lolwut.bpos = function(ent, bone) return ent:GetBonePosition(ent:LookupBone(bone)) end
  9. lolwut.bdist = function(ent, bone) return lolwut.lp:GetShootPos():Distance(lolwut.bpos(bone)) end
  10. lolwut.dist = function(ply) return lolwut.lp:GetShootPos():Distance(ply:GetShootPos()) end
  11. lolwut.closest = function(a, b) return lolwut.dist(a) < lolwut.dist(b) end
  12. lolwut.visible = function(pos,_) return util.QuickTrace(lolwut.lp:GetShootPos(), (pos - lolwut.lp:GetShootPos()), lolwut.lp).HitNonWorld end
  13. lolwut.pvalid = function(ply) return IsValid(ply) and ply:Alive() and ply ~= lolwut.lp end
  14. lolwut.fakeshot = function(func) func("+attack") timer.Simple(0.1, func, "-attack") end
  15. lolwut.keysnotdown = function(keys) for k,v in pairs(keys) do if input.IsKeyDown(v) then return false end end return true end
  16. lolwut.mousesnotdown = function(keys) for k,v in pairs(keys) do if input.IsMouseDown(v) then return false end end return true end
  17. lolwut.notmoving = function() return lolwut.keysnotdown({KEY_W,KEY_A,KEY_S,KEY_D,KEY_SPACE,KEY_LCONTROL,KEY_LSHIFT,KEY_LALT}) and
  18.     lolwut.mousesnotdown({MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE, MOUSE_4, MOUSE_5}) end
  19.  
  20. lolwut.calcview = function(ply, pos, ang, fov)
  21.     if input.IsKeyDown(KEY_B) then -------------------------<<<< AIM KEY
  22.         if input.IsKeyDown(KEY_DELETE) then
  23.             hook.Remove("CalcView", "lolwut1")
  24.         end
  25.        
  26.         local possible = {} for k,v in pairs(player.GetAll()) do
  27.             if lolwut.pvalid(v) /*and lolwut.visible(lolwut.bpos(v, lolwut.prefbone))*/ then table.insert(possible, v) end
  28.         end
  29.         table.sort(possible, lolwut.closest)
  30.         local closest = possible[1]
  31.        
  32.         if IsValid(closest) then
  33.             if (lolwut.lastangle == nil) then lolwut.lastangle = lolwut.lp:EyeAngles() end
  34.             local ang = (lolwut.bpos(closest, lolwut.prefbone) - lolwut.lp:GetShootPos()):Angle()
  35.             lolwut.lp:SetEyeAngles(ang)
  36.             if input.IsMouseDown(MOUSE_5) then -----------------------------------------------------<<<FIRE BUTTON
  37.                 local x = {origin = pos, angles = lolwut.lastangle, fov = fov}
  38.                 lolwut.fakeshot(RunConsoleCommand)
  39.                 return x
  40.             end lolwut.lastangle = nil
  41.         else lolwut.lastangle = nil end
  42.     elseif input.IsKeyDown(KEY_N) and lolwut.notmoving() then --------------<<<<<SPINBOT BUTTON
  43.         lolwut.fakeview = true
  44.         if (lolwut.lastangle == nil) then lolwut.lastangle = lolwut.lp:EyeAngles() end
  45.         local x = {origin = pos, angles = lolwut.lastangle, fov = fov}
  46.         lolwut.lp:SetEyeAngles(Angle(math.random(-180,180), math.random(-180,180), math.random(-180,180)))
  47.         return x
  48.     else
  49.         if (lolwut.fakeview == true) then
  50.             lolwut.lp:SetEyeAngles(lolwut.lastangle)
  51.             lolwut.fakeview = false
  52.         end
  53.         lolwut.lastangle = nil
  54.     end
  55. end
  56. hook.Add("CalcView", "lolwut1", lolwut.calcview)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement