Advertisement
Guest User

Esp

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