Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lolwut = {}
- lolwut.AimKey = function() return input.IsKeyDown(KEY_B) end
- lolwut.ShootKey = function() return input.IsMouseDown(MOUSE_5) end
- lolwut.SpinKey = function() return input.IsKeyDown(KEY_N) end
- lolwut.lp = LocalPlayer()
- lolwut.lastangle = Angle(0,0,0)
- lolwut.fakeview = false
- lolwut.prefbone = "ValveBiped.Bip01_Head1"
- lolwut.bpos = function(ent, bone) return ent:GetBonePosition(ent:LookupBone(bone)) end
- lolwut.bdist = function(ent, bone) return lolwut.lp:GetShootPos():Distance(lolwut.bpos(bone)) end
- lolwut.dist = function(ply) return lolwut.lp:GetShootPos():Distance(ply:GetShootPos()) end
- lolwut.closest = function(a, b) return lolwut.dist(a) < lolwut.dist(b) end
- lolwut.visible = function(pos,_) return util.QuickTrace(lolwut.lp:GetShootPos(), (pos - lolwut.lp:GetShootPos()), lolwut.lp).HitNonWorld end
- lolwut.pvalid = function(ply) return IsValid(ply) and ply:Alive() and ply ~= lolwut.lp end
- lolwut.fakeshot = function(func) func("+attack") timer.Simple(0.1, func, "-attack") end
- lolwut.keysnotdown = function(keys) for k,v in pairs(keys) do if input.IsKeyDown(v) then return false end end return true end
- lolwut.mousesnotdown = function(keys) for k,v in pairs(keys) do if input.IsMouseDown(v) then return false end end return true end
- lolwut.notmoving = function() return lolwut.keysnotdown({KEY_W,KEY_A,KEY_S,KEY_D,KEY_SPACE,KEY_LCONTROL,KEY_LSHIFT,KEY_LALT}) and
- lolwut.mousesnotdown({MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE, MOUSE_4, MOUSE_5}) end
- lolwut.calcview = function(ply, pos, ang, fov)
- if lolwut.AimKey() then
- if input.IsKeyDown(KEY_DELETE) then
- hook.Remove("CalcView", "lolwut1")
- end
- local possible = {} for k,v in pairs(player.GetAll()) do
- if lolwut.pvalid(v) --[[and lolwut.visible(lolwut.bpos(v, lolwut.prefbone))]] then table.insert(possible, v) end
- end
- table.sort(possible, lolwut.closest)
- local closest = possible[1]
- if IsValid(closest) then
- if (lolwut.lastangle == nil) then lolwut.lastangle = lolwut.lp:EyeAngles() end
- local ang = (lolwut.bpos(closest, lolwut.prefbone) - lolwut.lp:GetShootPos()):Angle()
- lolwut.lp:SetEyeAngles(ang)
- if lolwut.ShootKey() then
- local x = {origin = pos, angles = lolwut.lastangle, fov = fov}
- lolwut.fakeshot(RunConsoleCommand)
- return x
- end lolwut.lastangle = nil
- else lolwut.lastangle = nil end
- elseif lolwut.SpinKey() and lolwut.notmoving() then
- lolwut.fakeview = true
- if (lolwut.lastangle == nil) then lolwut.lastangle = lolwut.lp:EyeAngles() end
- local x = {origin = pos, angles = lolwut.lastangle, fov = fov}
- lolwut.lp:SetEyeAngles(Angle(math.random(-180,180), math.random(-180,180), math.random(-180,180)))
- return x
- else
- if (lolwut.fakeview == true) then
- lolwut.lp:SetEyeAngles(lolwut.lastangle)
- lolwut.fakeview = false
- end
- lolwut.lastangle = nil
- end
- end
- hook.Add("CalcView", "lolwut1", lolwut.calcview)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement