Guest User

Aimbot

a guest
May 13th, 2012
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.26 KB | None | 0 0
  1. //Aimbot By Logic_Bomb
  2. //Tracer Hook Originally by BobFM (Editted By Logic_Bomb)
  3.  
  4. /* To Do List
  5.  
  6. Aimbot -
  7.  
  8.         • Need fix: Aims behind / in front while target is moving parallel to user
  9.         • Aim @ closest, specific player, more versatile options [Fixed]
  10.         • Crossbow compensation? (Possibility)
  11.         • Safe mode - Admin within FoV disables aimbot (togglable)
  12.  
  13. + Derma Controls (Requires complete overhaul of code, however)
  14. + No Recoil (Definitely going to be a team effort)
  15. + Laser sight
  16.  
  17. To Do List */
  18.  
  19.  
  20. hook.Add("Think", "KeyListener", KeyListener)
  21. hook.Add("HUDPaint", "Tracer", Draw)
  22. hook.Add("HUDPaint", "AimStats", HUD)
  23. hook.Add("Think", "Aimbot", Aim)
  24. hook.Add("Think", "Nick_Listener", GetNicks)
  25. hook.Add("HUDPaint", "GetDarkRP", GetDRPStats)
  26.  
  27. local DebugOn = CreateClientConVar("ae_debug", "0", false, false)
  28.  
  29. local FireOn = false
  30. local Target = false
  31. local TargetOn = false
  32. local KeyTimer = tonumber(os.clock())
  33. local KeyNow = tonumber(os.clock())
  34.  
  35. local DoDraw = false
  36. local DoRect = true
  37. local DoText = false
  38. local DoAim = false
  39. local DoTrigger = false
  40. local ShowHUD = true
  41.  
  42. local DoDarkRP = true
  43.  
  44. local SelectedNick = nil
  45. local TempNick = nil
  46.  
  47. local NickCount = 1
  48. local TotalNicks = 1
  49. local NickReady = false
  50.  
  51. local SavedNick = 100
  52. local SelPlayer = nil
  53.  
  54. local ClosestE = 10000000
  55.  
  56. function Draw() //Tracer Hook - Used to draw tracers to players
  57.     for k, v in pairs (player.GetAll()) do
  58.         if (v != LocalPlayer()) and (v:Alive()) then
  59.             local TPlayer = v:GetPos()
  60.             local TEnemy = LocalPlayer():GetPos()
  61.             local TX = 0
  62.             local TY = 0
  63.             local TZ = 0
  64.             local TT = 0
  65.             TX = TEnemy.x - TPlayer.x
  66.             TY = TEnemy.y - TPlayer.y
  67.             TZ = TEnemy.z - TPlayer.z
  68.             TT = TX + TY + TZ
  69.             TT = math.abs(TT)
  70.             TT = math.Round(TT)
  71.             TT = "Distance: " .. TT
  72.  
  73.             local EntPos = v:EyePos():ToScreen()
  74.             local EntPosWorld = v:EyePos()
  75.             local PlyPos = {x = ScrW()/2,
  76.                             y = ScrH()/2}
  77.             local pos = LocalPlayer():GetShootPos()
  78.  
  79.             if v:Team() != LocalPlayer():Team() then
  80.                 surface.SetDrawColor(255, 0, 0)
  81.                 surface.SetTextColor(255, 0, 0)
  82.             else
  83.                 surface.SetDrawColor(0, 255, 0)
  84.                 surface.SetTextColor(0, 255, 0)
  85.             end
  86.  
  87.             if v:IsBot() then
  88.                 surface.SetDrawColor(255, 255, 0)
  89.                 surface.SetTextColor(255, 255, 0)
  90.             end
  91.  
  92.             if v:IsAdmin() then
  93.                 surface.SetDrawColor(255, 0, 255)
  94.                 surface.SetTextColor(255, 0, 255)
  95.             end
  96.  
  97.             if v:IsSuperAdmin() then
  98.                 surface.SetDrawColor(255, 0, 255)
  99.                 surface.SetTextColor(255, 0, 255)
  100.             end
  101.  
  102.             if EntPos.y > 0 and EntPos.y < ScrH() then
  103.                 if DoDraw then
  104.                     surface.DrawLine(PlyPos.x, PlyPos.y, EntPos.x, EntPos.y)
  105.                 end
  106.                 if DoRect then
  107.                     surface.DrawOutlinedRect(EntPos.x, EntPos.y, 7, 7)
  108.                 end
  109.                 if DoText then
  110.                     surface.SetTextPos(EntPos.x-string.len(v:Nick())*3, EntPos.y+5)
  111.                     surface.DrawText(v:Nick())
  112.                     surface.SetTextPos(EntPos.x-string.len(TT)*3, EntPos.y+20)
  113.                     surface.DrawText(TT)
  114.                 end
  115.             end
  116.         end
  117.     end
  118. end
  119.  
  120. function Aim() //Autoaim Hook - Used to automatically aim at the head of the Player.
  121.     if DoAim then
  122.         for k, v in pairs (player.GetAll()) do
  123.             if !(v == LocalPlayer()) then
  124.                 local HeadPos = v:EyePos()
  125.                 local THead = v:LookupBone("ValveBiped.Bip01_Head1")
  126.                 local HeadPos = v:GetBonePosition(THead)
  127.                 local PlyPos = {x = ScrW()/2,
  128.                                 y = ScrH()/2}
  129.                 local pos = LocalPlayer():GetShootPos()
  130.                 if SelectedNick != nil then
  131.                     if v:Alive() and v:Nick() == SelectedNick then
  132.                         LocalPlayer():SetEyeAngles((HeadPos - pos):Angle())
  133.                         local Target = true
  134.                     else
  135.                         local Target = false
  136.                     end
  137.                 end
  138.             end
  139.         end
  140.     end
  141. end
  142.  
  143. function GetDRPStats() //Used to find DarkRP items
  144.     if DoDarkRP and LocalPlayer():Alive() then
  145.         for k, v in pairs(ents.GetAll()) do
  146.             local EntitPos = v:GetPos():ToScreen()
  147.             local ECoords = v:GetPos()
  148.             local PCoords = LocalPlayer():GetPos()
  149.             local DistX = 0
  150.             local DistY = 0
  151.             local DistZ = 0
  152.             local DistT = 0
  153.             DistX = ECoords.x - PCoords.x
  154.             DistY = ECoords.y - PCoords.y
  155.             DistZ = ECoords.z - PCoords.z
  156.             DistT = DistX + DistY + DistZ
  157.             DistT = math.abs(DistT)
  158.             DistT = math.Round(DistT)
  159.             //Debug Method
  160.             if v:GetModel() != nil and DebugOn:GetBool() then
  161.                 surface.SetTextColor(255,255,255)
  162.                 surface.SetTextPos(EntitPos.x-100, EntitPos.y-30)
  163.                 surface.DrawText(v:GetModel())
  164.             end
  165.             //Money Printers
  166.             if (v:GetModel() == "models/props_c17/consolebox01a.mdl") or (v:GetModel() == "models/props_c17/consolebox03a.mdl") then
  167.                 surface.SetDrawColor(0, 0, 255)
  168.                 surface.SetTextColor(0, 0, 255)
  169.                 surface.SetTextPos(EntitPos.x-15, EntitPos.y-30)
  170.                 surface.DrawText("$$$ - " .. DistT)
  171.                 surface.DrawOutlinedRect(EntitPos.x, EntitPos.y-10, 7, 7)
  172.             end
  173.             //Cash
  174.             if (v:GetModel() == "models/props/cs_assault/money.mdl") then
  175.                 surface.SetDrawColor(0, 0, 255)
  176.                 surface.SetTextColor(0, 0, 255)
  177.                 surface.SetTextPos(EntitPos.x-15, EntitPos.y-30)
  178.                 surface.DrawText("$$$ - " .. DistT)
  179.                 surface.DrawOutlinedRect(EntitPos.x, EntitPos.y-10, 7, 7)
  180.             end
  181.             //Weapons Spawner
  182.             if (v:GetModel() == "models/props_c17/trappropeller_engine.mdl") then
  183.                 surface.SetDrawColor(0, 0, 255)
  184.                 surface.SetTextColor(0, 0, 255)
  185.                 surface.SetTextPos(EntitPos.x-15, EntitPos.y-30)
  186.                 surface.DrawText("SPAWNER")
  187.                 surface.DrawOutlinedRect(EntitPos.x, EntitPos.y-10, 7, 7)
  188.             end
  189.             //Weps
  190.             if (v:GetModel() == "models/weapons/w_pist_deagle.mdl") or
  191.                 (v:GetModel() == "models/weapons/w_pist_fiveseven.mdl") or
  192.                 (v:GetModel() == "models/weapons/w_pist_glock18.mdl") or
  193.                 (v:GetModel() == "models/weapons/w_pist_p228.mdl") or
  194.                 (v:GetModel() == "models/weapons/w_pist_usp.mdl") or
  195.                 (v:GetModel() == "models/weapons/w_pist_elite_dropped.mdl") then
  196.                 surface.SetDrawColor(0, 0, 255)
  197.                 surface.SetTextColor(0, 0, 255)
  198.                 surface.SetTextPos(EntitPos.x-5, EntitPos.y-30)
  199.                 surface.DrawText("GUN")
  200.                 surface.DrawOutlinedRect(EntitPos.x, EntitPos.y-10, 7, 7)
  201.             end
  202.             if v:IsWeapon() then
  203.                 surface.SetDrawColor(0, 0, 255)
  204.                 surface.SetTextColor(0, 0, 255)
  205.                 surface.SetTextPos(EntitPos.x-5, EntitPos.y-30)
  206.                 surface.DrawText("GUN")
  207.                 surface.DrawOutlinedRect(EntitPos.x, EntitPos.y-10, 7, 7)
  208.             end
  209.         end
  210.     end
  211. end
  212.  
  213. function GetNicks() //Used to keep a DB of nicks
  214.  
  215. if !Target then
  216.     ClosestE = 10000000
  217.     for k, v in pairs (player.GetAll()) do
  218.     if v:IsValid()
  219.         //Math Stuff
  220.             local EnemCo = v:GetPos():ToScreen()
  221.             local MyCo = {x = ScrW()/2,
  222.                           y = ScrH()/2}
  223.             local DT = 0
  224.             DT = math.sqrt((MyCo.x - EnemCo.x)^2 + (MyCo.y - EnemCo.y)^2)
  225.             DT = math.Round(DT)
  226.             if v:Alive() and v != LocalPlayer() then
  227.                 if DT < ClosestE then
  228.                     TempNick = v:Nick()
  229.                     ClosestE = DT
  230.                 end
  231.             end
  232.     end
  233.     end
  234.     NickReady = false
  235.     SelectedNick = TempNick
  236.     NickReady = true
  237. end
  238. end
  239.  
  240. function KeyListener() //Key Listener Hook
  241.     if input.IsKeyDown(KEY_F6) then
  242.         KeyNow = tonumber(os.clock())
  243.         if KeyNow > KeyTimer then
  244.             DoDraw = !DoDraw
  245.             KeyTimer = tonumber(os.clock()) + 0.6
  246.         end
  247.     end
  248.     if input.IsKeyDown(KEY_F8) then
  249.         KeyNow = tonumber(os.clock())
  250.         if KeyNow > KeyTimer then
  251.             DoDarkRP = !DoDarkRP
  252.             if DoDarkRP then
  253.                 hook.Add("HUDPaint", "GetDarkRP", GetDRPStats)
  254.             end
  255.             KeyTimer = tonumber(os.clock()) + 0.6
  256.         end
  257.     end
  258.     if input.IsKeyDown(KEY_F9) then
  259.         KeyNow = tonumber(os.clock())
  260.         if KeyNow > KeyTimer then
  261.             KeyTimer = tonumber(os.clock()) + 0.6
  262.         end
  263.     end
  264.     if input.IsKeyDown(KEY_F10) then
  265.         KeyNow = tonumber(os.clock())
  266.         if KeyNow > KeyTimer then
  267.             DoRect = !DoRect
  268.             KeyTimer = tonumber(os.clock()) + 0.6
  269.         end
  270.     end
  271.     if input.IsKeyDown(KEY_F11) then
  272.         KeyNow = tonumber(os.clock())
  273.         if KeyNow > KeyTimer then
  274.             DoText = !DoText
  275.             KeyTimer = tonumber(os.clock()) + 0.6
  276.         end
  277.     end
  278.     if input.IsMouseDown(MOUSE_MIDDLE) then
  279.         KeyNow = tonumber(os.clock())
  280.         if KeyNow > KeyTimer then
  281.             DoAim = !DoAim
  282.             KeyTimer = tonumber(os.clock()) + 0.6
  283.         end
  284.     end
  285. end
  286.  
  287. function HUD() //HUD Paint Hook
  288.         if ShowHUD then
  289.             if SelectedNick != nil then
  290.                 draw.WordBox( 8, (ScrW()/2)-80, 8, "Aimbot Target: " .. SelectedNick, "Default", Color(50, 50, 75, 100), Color(0, 255, 0, 255) )
  291.             else
  292.                 draw.WordBox( 8, (ScrW()/2)-80, 8, "Aimbot Target: [Off]", "Default", Color(50, 50, 75, 100), Color(0, 255, 0, 255) )
  293.             end
  294.             //Tracers
  295.             if DoDraw then
  296.                 draw.WordBox( 8, 415, ScrH()-27, "[F6] Tracers [On]", "Default", Color(50, 50, 75, 100), Color(50, 205, 50, 255) )
  297.             else
  298.                 draw.WordBox( 8, 415, ScrH()-27, "[F6] Tracers [Off]", "Default", Color(50, 50, 75, 100), Color(190, 190, 190, 255) )
  299.             end
  300.             //Aimbot
  301.             if !DoAim then
  302.                 draw.WordBox( 8, 300, ScrH()-27, "[F7] Aimbot [OFF]", "Default", Color(50, 50, 75, 100), Color(190, 190, 190, 255) )
  303.             else
  304.                 draw.WordBox( 8, 300, ScrH()-27, "[F7] Aimbot [ON]  ", "Default", Color(50, 50, 75, 100), Color(50, 205, 50, 255) )
  305.             end
  306.             //Player Marker
  307.             if !DoRect then
  308.                 draw.WordBox( 8, 530, ScrH()-27, "[F10] Player Markers [OFF]", "Default", Color(50, 50, 75, 100), Color(190, 190, 190, 255) )
  309.             else
  310.                 draw.WordBox( 8, 530, ScrH()-27, "[F10] Player Markers [ON]  ", "Default", Color(50, 50, 75, 100), Color(50, 205, 50, 255) )
  311.             end
  312.             //Text
  313.             if !DoText then
  314.                 draw.WordBox( 8, 691, ScrH()-27, "[F11] Player Names [OFF]", "Default", Color(50, 50, 75, 100), Color(190, 190, 190, 255) )
  315.             else
  316.                 draw.WordBox( 8, 691, ScrH()-27, "[F10] Player Names [ON]  ", "Default", Color(50, 50, 75, 100), Color(50, 205, 50, 255) )
  317.             end
  318.             //DarkRP
  319.             if !DoDarkRP then
  320.                 draw.WordBox( 8, 845, ScrH()-27, "[F8] DarkRP [OFF]", "Default", Color(50, 50, 75, 100), Color(190, 190, 190, 255) )
  321.             else
  322.                 draw.WordBox( 8, 845, ScrH()-27, "[F8] DarkRP [On]", "Default", Color(50, 50, 75, 100), Color(50, 205, 50, 255) )
  323.             end
  324.         end
  325. end
Advertisement
Add Comment
Please, Sign In to add comment