Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- UGLY AAAAA
- local hooked = false
- local jumpdist = 150
- local hooked2 = false
- local gundist = 100
- local hooked3 = false
- local attackdist = 70
- function CrazyCreateMove(UCMD)
- local closest, dist = nil, 8192
- for _,pl in pairs(player.GetAll()) do
- local length = (pl:GetPos()-LocalPlayer():GetPos()):Length()
- if pl ~= LocalPlayer() and length < dist then
- dist = length
- closest = pl
- end
- end
- if closest then
- if dist < jumpdist and !hooked then
- hooked=true
- print("Jumping because of",closest,dist)
- timer.Create('Jump',0.3,0,function()
- RunConsoleCommand('+jump')
- timer.Simple(0.1,function()
- RunConsoleCommand('-jump')
- end)
- end)
- elseif dist >= jumpdist and hooked then
- hooked=false
- timer.Destroy('Jump')
- print("Stopped jumping")
- end
- if dist < gundist and !hooked2 then
- hooked2=true
- print("Came 2close:",closest,dist)
- RunConsoleCommand('use','weapon_crowbar')
- elseif dist >= gundist and hooked2 then
- hooked2=false
- RunConsoleCommand('use','weapon_physcannon')
- end
- if dist < attackdist and !hooked3 then
- hooked3=true
- print("Attacking:",closest,dist)
- RunConsoleCommand('+attack')
- elseif dist >= attackdist and hooked3 then
- hooked3=false
- RunConsoleCommand('-attack')
- end
- local newang = (closest:GetShootPos()-LocalPlayer():GetShootPos()):Normalize():Angle()
- local oldang = UCMD:GetViewAngles()
- local realnew = Angle()
- local asd = 0.8
- realnew.p = math.ApproachAngle(oldang.p,newang.p,asd)
- realnew.y = math.ApproachAngle(oldang.y,newang.y,asd)
- realnew.r = math.ApproachAngle(oldang.r,newang.r,asd)
- UCMD:SetViewAngles(realnew)
- end
- end
- concommand.Add('+idle',function()
- hook.Add("CreateMove", "Idle", CrazyCreateMove)
- end)
- concommand.Add('-idle',function()
- timer.Destroy('Jump')
- hook.Remove("CreateMove", "Idle")
- end)
Advertisement
Add Comment
Please, Sign In to add comment