Python1320

Untitled

Mar 28th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1. -- UGLY AAAAA
  2.  
  3. local hooked = false
  4. local jumpdist = 150
  5.  
  6. local hooked2 = false
  7. local gundist = 100
  8.  
  9. local hooked3 = false
  10. local attackdist = 70
  11.  
  12. function CrazyCreateMove(UCMD)
  13.     local closest, dist = nil, 8192
  14.     for _,pl in pairs(player.GetAll()) do  
  15.         local length = (pl:GetPos()-LocalPlayer():GetPos()):Length()  
  16.         if pl ~= LocalPlayer() and length < dist then  
  17.             dist = length
  18.             closest = pl
  19.         end  
  20.     end  
  21.    
  22.     if closest then  
  23.        
  24.        
  25.         if dist < jumpdist and !hooked then
  26.            
  27.             hooked=true
  28.             print("Jumping because of",closest,dist)
  29.             timer.Create('Jump',0.3,0,function()
  30.                 RunConsoleCommand('+jump')
  31.                
  32.                 timer.Simple(0.1,function()
  33.                     RunConsoleCommand('-jump')
  34.                 end)   
  35.             end)
  36.            
  37.         elseif dist >= jumpdist and hooked then
  38.            
  39.             hooked=false
  40.            
  41.             timer.Destroy('Jump')
  42.             print("Stopped jumping")
  43.        
  44.         end
  45.        
  46.         if dist < gundist and !hooked2 then
  47.            
  48.             hooked2=true
  49.             print("Came 2close:",closest,dist)
  50.             RunConsoleCommand('use','weapon_crowbar')
  51.            
  52.         elseif dist >= gundist and hooked2 then
  53.            
  54.             hooked2=false
  55.             RunConsoleCommand('use','weapon_physcannon')                   
  56.  
  57.        
  58.         end
  59.        
  60.        
  61.         if dist < attackdist and !hooked3 then
  62.            
  63.             hooked3=true
  64.             print("Attacking:",closest,dist)
  65.             RunConsoleCommand('+attack')
  66.            
  67.         elseif dist >= attackdist and hooked3 then
  68.            
  69.             hooked3=false
  70.             RunConsoleCommand('-attack')
  71.  
  72.        
  73.         end    
  74.        
  75.        
  76.         local newang = (closest:GetShootPos()-LocalPlayer():GetShootPos()):Normalize():Angle()
  77.        
  78.         local oldang = UCMD:GetViewAngles()
  79.        
  80.         local realnew = Angle()
  81.         local asd = 0.8
  82.        
  83.         realnew.p = math.ApproachAngle(oldang.p,newang.p,asd)
  84.         realnew.y = math.ApproachAngle(oldang.y,newang.y,asd)
  85.         realnew.r = math.ApproachAngle(oldang.r,newang.r,asd)
  86.        
  87.         UCMD:SetViewAngles(realnew)
  88.     end
  89.    
  90.    
  91. end
  92.  
  93.  
  94. concommand.Add('+idle',function()
  95.     hook.Add("CreateMove", "Idle", CrazyCreateMove)
  96. end)
  97. concommand.Add('-idle',function()
  98.     timer.Destroy('Jump')
  99.     hook.Remove("CreateMove", "Idle")
  100. end)
Advertisement
Add Comment
Please, Sign In to add comment