Advertisement
soleedus

rifk

Jan 10th, 2012
2,157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.29 KB | None | 0 0
  1. -- happy trolling
  2.  
  3. surface.CreateFont("Coolvetica", 24, 700, true, false, "ElebotPlayerTitle")
  4. surface.CreateFont("Arial", 12, 400, true, false, "ElebotPlayerInfo")
  5.  
  6. local target = nil;
  7.  
  8. if (cmdStr != nil and cmdStr != NULL) then
  9.     concommand.Remove("+"..cmdStr)
  10.     concommand.Remove("-"..cmdStr)
  11. end
  12.  
  13. local cmdStr = "elebot"
  14. local offset = CreateClientConVar(cmdStr.."_offset", 24, true, false)
  15. local targetTeam = CreateClientConVar(cmdStr.."_targetteam", 0, true, false)
  16. local simpleColors = CreateClientConVar(cmdStr.."_simplecolors", 1, true, false)
  17. local maxView = CreateClientConVar(cmdStr.."_maxview", 4800, true, false)
  18. local minView = CreateClientConVar(cmdStr.."_minview", 120, true, false)
  19. local boxSize = CreateClientConVar(cmdStr.."_boxsize", 10, true, false)
  20. local filledBox = CreateClientConVar(cmdStr.."_filledbox", 0, true, false)
  21. local showAdmin = CreateClientConVar(cmdStr.."_showadmin", 1, true, false)
  22. local shouldESP = CreateClientConVar(cmdStr.."_esp", 1, true, false)
  23. local filterProps = CreateClientConVar(cmdStr.."_xray", 1, true, false)
  24.  
  25. local function TrackTarget(UCMD)
  26.     if !target or !ValidEntity(target) then
  27.  
  28.         local filterTable = {LocalPlayer()}
  29.        
  30.         if (filterProps:GetBool()) then
  31.             if (ents.GetAll()[1]:IsWorld()) then
  32.                 print("World found!")
  33.                 table.insert(filterTable, ents.GetAll()[1])
  34.             end
  35.             for k,v in pairs (ents.GetAll()) do
  36.                 if !(v:IsNPC() or v:IsPlayer()) then
  37.                     table.insert(filterTable, v)
  38.                 end
  39.             end
  40.         end
  41.        
  42.         /*
  43.         if (ents.FindByClass("worldspawn") != nil) then
  44.             print("Found world entity!")
  45.             table.insert(filterTable, ents.FindByClass("worldspawn")[1])
  46.         end
  47.         */
  48.        
  49.        
  50.         local trace = util.QuickTrace(LocalPlayer():GetShootPos(), LocalPlayer():GetAimVector() * 100000, filterTable)
  51.        
  52.         /*
  53.         local traceTable = {start = LocalPlayer():GetShootPos(), endpos = LocalPlayer():GetAimVector() * 10000, filter = filterTable}
  54.        
  55.         local trace = util.TraceLine(traceTable)
  56.         */
  57.         /*
  58.         if (trace.Entity and ValidEntity(trace.Entity) and trace.Entity:IsValid() and (trace.Entity:IsPlayer() or trace.Entity:IsNPC())) then
  59.             if trace.Entity:IsPlayer() and !targetTeam:GetBool() and trace.Entity:Team() == LocalPlayer():Team() then
  60.                 return
  61.             else
  62.                 target = trace.Entity
  63.             end
  64.         else
  65.             return
  66.         end
  67.         */
  68.        
  69.         if (trace.Entity and ValidEntity(trace.Entity)) then
  70.             if (trace.Entity:IsPlayer()) then
  71.                 if !targetTeam:GetBool() and trace.Entity:Team() == LocalPlayer():Team() then
  72.                     return
  73.                 else
  74.                     target = trace.Entity
  75.                 end
  76.             else
  77.                 if (trace.Entity:IsNPC()) then
  78.                     target = trace.Entity
  79.                 else
  80.                     return
  81.                 end
  82.             end
  83.         else
  84.             return
  85.         end
  86.     end
  87.    
  88.     /*
  89.     if (target:OBBMaxs().z < offset:GetFloat() or string.find(target:GetModel(), "crab") or string.find(target:GetModel(), "torso")) then
  90.         UCMD:SetViewAngles((target:GetPos() + Vector(0, 0, target:OBBMaxs().z * 0.25) - LocalPlayer():GetShootPos()):Normalize():Angle())
  91.     else
  92.         UCMD:SetViewAngles((target:GetPos() + Vector(0, 0, offset:GetFloat()) - LocalPlayer():GetShootPos()):Normalize():Angle())
  93.     end
  94.     */
  95.     if (target:GetAttachment(target:LookupAttachment("eyes"))) then //Standard
  96.         UCMD:SetViewAngles((target:GetAttachment(target:LookupAttachment("eyes")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
  97.     elseif (target:GetAttachment(target:LookupAttachment("forward"))) then //CSS models
  98.         UCMD:SetViewAngles((target:GetAttachment(target:LookupAttachment("forward")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
  99.     elseif (target:GetAttachment(target:LookupAttachment("head"))) then //Zombies
  100.         UCMD:SetViewAngles((target:GetAttachment(target:LookupAttachment("head")).Pos - LocalPlayer():GetShootPos()):Normalize():Angle())
  101.     else //Headcrabs, antlions, etc.
  102.         UCMD:SetViewAngles((target:GetPos() + Vector(0, 0, offset:GetFloat()) - LocalPlayer():GetShootPos()):Normalize():Angle())
  103.     end
  104. end
  105.  
  106. local function PaintTargets()
  107.     if (!shouldESP:GetBool()) then return end
  108.     local adminList = "";
  109.     for k,v in pairs (ents.GetAll()) do
  110.         if v:IsNPC() then
  111.             local pos = (v:GetPos() + Vector(0, 0, offset:GetFloat())):ToScreen()
  112.            
  113.             if v:OBBMaxs().z < offset:GetFloat() then
  114.                 pos = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.25)):ToScreen()
  115.             end
  116.            
  117.             if (pos.visible) then
  118.                 local alpha = math.Clamp((maxView:GetFloat() - v:GetPos():Distance(LocalPlayer():GetShootPos())) * (255 / (maxView:GetFloat() - minView:GetFloat())), 30, 255)
  119.                 draw.SimpleText(string.gsub(v:GetClass(), "npc_", ""), "ElebotPlayerTitle",  pos.x, pos.y, Color(0, 255, 0, alpha), 1, 1)
  120.                 local boxCenter = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z)):ToScreen()
  121.                 local bL = boxSize:GetFloat()
  122.                 if (filledBox:GetBool() && bL != 0) then
  123.                     draw.RoundedBox(1, boxCenter.x - bL, boxCenter.y - bL, bL * 2, bL * 2, Color(0, 255, 0, alpha))
  124.                 else
  125.                     if (!filledBox:GetBool() && bL != 0) then
  126.                         local bL = boxSize:GetFloat()
  127.                         surface.SetDrawColor(0, 255, 0, alpha)
  128.                         surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x - bL, boxCenter.y - bL) //Left vertical
  129.                         surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x + bL, boxCenter.y + bL) //Bottom horizontal
  130.                         surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x - bL, boxCenter.y - bL) // Top horizontal
  131.                         surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x + bL, boxCenter.y + bL) //Right vertical
  132.                     end
  133.                 end
  134.             end
  135.         else
  136.             if v:IsPlayer() then
  137.                 local pos = (v:GetPos() + Vector(0, 0, offset:GetFloat())):ToScreen()
  138.                
  139.                 if string.find(v:GetModel(), "crab") or string.find(v:GetModel(), "torso") then
  140.                     pos = (v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.25)):ToScreen()
  141.                 end
  142.                
  143.                 if (pos.visible and v != LocalPlayer() and v.Nick and v.Health and v.GetActiveWeapon and v:GetActiveWeapon().GetPrintName) then
  144.                     local alpha = math.Clamp((maxView:GetFloat() - v:GetPos():Distance(LocalPlayer():GetShootPos())) * (255 / (maxView:GetFloat() - minView:GetFloat())), 30, 255)
  145.                     local tcol// = team.GetColor(v:Team())
  146.                     if (simpleColors:GetBool()) then
  147.                         if (v:Team() == LocalPlayer():Team()) then
  148.                             tcol = Color(0, 255, 0, alpha)
  149.                         else
  150.                             tcol = Color(255, 0, 0, alpha)
  151.                         end
  152.                     else
  153.                         tcol = team.GetColor(v:Team())
  154.                         tcol = Color(tcol.r, tcol.g, tcol.b, alpha)
  155.                     end
  156.                    
  157.                     draw.SimpleText(v:Nick(), "ElebotPlayerTitle", pos.x, pos.y, tcol, 1, 1)
  158.                     draw.SimpleText("HP: "..v:Health(), "ElebotPlayerInfo", pos.x, pos.y + 25, tcol, 1, 1)
  159.                     draw.SimpleText("Weapon: "..v:GetActiveWeapon():GetPrintName(), "ElebotPlayerInfo", pos.x, pos.y + 38, tcol, 1, 1)
  160.                     local boxCenter = ((v:GetPos() + Vector(0, 0, v:OBBMaxs().z * 0.9))):ToScreen()
  161.                     local bL = boxSize:GetFloat()
  162.                     if (filledBox:GetBool() && bL != 0) then
  163.                         draw.RoundedBox(1, boxCenter.x - bL, boxCenter.y - bL, bL * 2, bL * 2, tcol)
  164.                     else
  165.                         if (!filledBox:GetBool() && bL != 0) then
  166.                             surface.SetDrawColor(tcol.r, tcol.g, tcol.b, alpha)
  167.                             surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x - bL, boxCenter.y - bL) //Left vertical
  168.                             surface.DrawLine(boxCenter.x - bL, boxCenter.y + bL, boxCenter.x + bL, boxCenter.y + bL) //Bottom horizontal
  169.                             surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x - bL, boxCenter.y - bL) // Top horizontal
  170.                             surface.DrawLine(boxCenter.x + bL, boxCenter.y - bL, boxCenter.x + bL, boxCenter.y + bL) //Right vertical
  171.                         end
  172.                     end
  173.                 end
  174.                
  175.                 if v:IsAdmin() or v:IsSuperAdmin() then
  176.                     adminList = adminList..", "..v:Nick()
  177.                 end
  178.  
  179.                
  180.             end
  181.         end
  182.     end
  183.    
  184.     if (showAdmin:GetBool()) then
  185.         if (adminList != "") then
  186.             adminList = string.sub(adminList, 3, string.len(adminList))
  187.             draw.SimpleText("Admins: "..adminList, "ElebotPlayerInfo", ScrW() * 0.8, ScrH() * 0.2, Color(0, 255, 0, 200), 1, 1)
  188.         else
  189.             draw.SimpleText("No admins online!", "ElebotPlayerInfo", ScrW() * 0.8, ScrH() * 0.2, Color(255, 0, 0, 200), 1, 1)
  190.         end
  191.     end
  192. end
  193. hook.Add("HUDPaint", "PaintTargets", PaintTargets)
  194.  
  195.  
  196. local function AimbotOn(ply, cmd, args)
  197.     hook.Add("CreateMove", "TrackTarget", TrackTarget)
  198. end
  199. concommand.Add("+"..cmdStr, AimbotOn)
  200.  
  201. local function AimbotOff(ply, cmd, args)
  202.     target = nil
  203.     hook.Remove("CreateMove", "TrackTarget")
  204. end
  205. concommand.Add("-"..cmdStr, AimbotOff)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement