Skip to content

Instantly share code, notes, and snippets.

@complover116
Last active April 29, 2016 17:19
Show Gist options
  • Save complover116/85b714990a10a6a64c4b to your computer and use it in GitHub Desktop.
Save complover116/85b714990a10a6a64c4b to your computer and use it in GitHub Desktop.
A one-file clientside cheat engine for garrysmod
surface.PlaySound( "/HL1/fvox/activated.wav" )
//CONST
aaKey = KEY_M
//VAR
autoaim = true
buttontime = 0
systems = { }
//Messaging
ms = {}
ms.r = 0
ms.g = 0
ms.b = 0
ms.show = true
ms.enabled = false
ms.height = 50
ms.expanded = true
ms.alpha = 1000
ms.name = "UltraBot Active"
ms.key = 0
ms.message = "This server allows clientside LUA"
ms.message2 = "You can use UltraBot on this server"
ms.onDraw = function(y)
//surface.SetDrawColor( 0, 0, 0, 255)
surface.DrawRect(200, y-15, 100, ms.height)
draw.SimpleText(ms.name, "HudHintTextLarge", 10, y, Color(255,255,255,ms.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
draw.SimpleText(ms.message, "HudHintTextLarge", 10, y+15, Color(255,255,255,ms.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
draw.SimpleText(ms.message2, "HudHintTextLarge", 10, y+30, Color(255,255,255,ms.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
ms.onTick = function()
end
systems.aams = ms
//AIMSYSTEM
aimsystem = {}
aimsystem.r = 0
aimsystem.g = 0
aimsystem.b = 255
aimsystem.aggressive = false
aimsystem.show = false
aimsystem.enabled = false
aimsystem.autofire = true
aimsystem.retarget = true
aimsystem.height = 50
aimsystem.expanded = true
aimsystem.alpha = 0
aimsystem.name = "Automatic Aiming"
aimsystem.target = nil
aimsystem.lastPos = Vector(0,0,0)
aimsystem.key = KEY_M
aimsystem.onDraw = function(y)
draw.SimpleText("Automatic Aiming", "HudHintTextLarge", 10, y, Color(255,255,255,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
if systems.aim.enabled then
if systems.aim.aggressive then
draw.SimpleText("AGGRESSIVE", "HudHintTextLarge", 10, y+15, Color(255,0,0,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
else
draw.SimpleText("ENABLED", "HudHintTextLarge", 10, y+15, Color(255,0,0,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
else
draw.SimpleText("DISABLED", "HudHintTextLarge", 10, y+15, Color(255,0,0,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
if systems.aim.target == nil then
draw.SimpleText("No target", "HudHintTextLarge", 10, y+30, Color(255,0,0,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
else
if systems.aim.target:IsValid() then
draw.SimpleText("Locked:"..systems.aim.target:GetClass(), "HudHintTextLarge", 10, y+30, Color(0,255,0,systems.aim.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
end
end
aimsystem.onTick = function()
systems.aim.target = nil
if !input.IsKeyDown(KEY_G) then
tr = LocalPlayer():GetEyeTrace()
if tr.HitNonWorld then
local target = tr.Entity
pos = aimPos(target)
if pos != nil then
systems.aim.target = tr.Entity
aimBot(pos)
end
end
else
local best = nil
local bestD = 5000
for k, v in pairs(ents.GetAll()) do
pos = aimPos(v)
if pos != nil then
local tr = util.TraceLine( {
start = EyePos(),
endpos = pos,
filter = {v, LocalPlayer()}
} )
if v:IsValid() && v:Health() > 0 then
if v:GetPos():Distance(LocalPlayer():GetPos()) < bestD then
bestD = v:GetPos():Distance(LocalPlayer():GetPos())
best = v
end
end
end
end
if best != nil then
pos = aimPos(best)
systems.aim.target = best
aimBot(pos)
end
end
end
systems.aim = aimsystem
//HEALTH SEARCHER
hs = {}
hs.r = 0
hs.g = 255
hs.b = 0
hs.show = false
hs.enabled = false
hs.height = 30
hs.expanded = true
hs.alpha = 0
hs.key = KEY_H
hs.name = "Health Searher"
hs.onDraw = function(y)
draw.SimpleText("Health Searher", "HudHintTextLarge", 10, y, Color(255,255,255,systems.hs.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
for k,v in pairs(ents.GetAll()) do
local good = false
local health = 0
if v:GetClass() == "item_healthvial" then
good = true
health = 10
end
if v:GetClass() == "item_healthkit" then
good = true
health = 25
end
if v:GetClass() == "item_healthcharger" then
good = true
health = 50
end
if good then
local pos = v:GetPos():ToScreen()
draw.SimpleText("+"..health.."hp", "HudHintTextLarge", pos.x, pos.y, Color(0,255,0,systems.hs.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
surface.SetDrawColor( 50, 255, 50, systems.hs.alpha - 155)
surface.DrawRect(pos.x - 5, pos.y - 5, 10, 10 )
end
end
end
hs.onTick = function()
if LocalPlayer():Health() > 99 then
systems.hs.enabled = false
surface.PlaySound( "buttons/blip1.wav")
message("Health restored", "Health is at 100", "Health searcher automatically deactivated")
end
end
systems.hs = hs
//TARGETTING SYSTEM
ts = {}
ts.r = 250
ts.g = 100
ts.b = 0
ts.show = false
ts.enabled = false
ts.height = 30
ts.expanded = true
ts.alpha = 0
ts.key = KEY_B
ts.name = "Advanced Targetting System"
ts.onDraw = function(y)
draw.SimpleText("Advanced Targetting System", "HudHintTextLarge", 10, y, Color(255,255,255,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
bestD = 1000
chosen = nil
for k,v in pairs(ents.GetAll()) do
pos2 = aimPos(v)
if pos2 != nil then
local pos = pos2:ToScreen()
if v:GetClass()=="player" then
draw.SimpleText(v:GetName(), "HudHintTextLarge", pos.x, pos.y, Color(255,50,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
else
draw.SimpleText(v:GetClass(), "HudHintTextLarge", pos.x, pos.y, Color(255,50,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
surface.SetDrawColor( 255, 50, 50, systems.ts.alpha - 155)
surface.DrawRect(pos.x - 5, pos.y - 5, 10, 10 )
if dist2d(pos.x, pos.y, ScrW()/2, ScrH()/2) < bestD then
bestD = dist2d(pos.x, pos.y, ScrW()/2, ScrH()/2)
chosen = v
end
end
end
if chosen == nil then
ts.height = 30
draw.SimpleText("No target", "HudHintTextLarge", 10, y+13, Color(0,0,250,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
else
ts.height = 60
draw.SimpleText("Target:"..chosen:GetClass(), "HudHintTextLarge", 10, y+13, Color(0,255,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
draw.SimpleText("Health:"..chosen:Health(), "HudHintTextLarge", 10, y+28, Color(0,255,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
local activeWeapon = chosen:GetActiveWeapon( )
if activeWeapon == nil then
draw.SimpleText("No weapon", "HudHintTextLarge", 10, y+42, Color(0,0,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
else
//draw.SimpleText("Weapon:"..activeWeapon:GetClass(), "HudHintTextLarge", 10, y+42, Color(0,0,0,systems.ts.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
end
end
end
ts.onTick = function()
end
systems.ts = ts
//CHARGE SEARCHER
cs = {}
cs.r = 0
cs.g = 200
cs.b = 200
cs.show = false
cs.enabled = false
cs.height = 30
cs.expanded = true
cs.alpha = 0
cs.key = KEY_J
cs.name = "Charge Searher"
cs.onDraw = function(y)
draw.SimpleText("Charge Searher", "HudHintTextLarge", 10, y, Color(255,255,255,systems.cs.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
for k,v in pairs(ents.GetAll()) do
local good = false
local health = 0
if v:GetClass() == "item_battery" then
good = true
health = 15
end
if v:GetClass() == "item_suitcharger" then
good = true
health = 30
end
if good then
local pos = v:GetPos():ToScreen()
draw.SimpleText("+"..health.."hp", "HudHintTextLarge", pos.x, pos.y, Color(0,0,255,systems.cs.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
surface.SetDrawColor( 50, 50, 255, systems.cs.alpha - 155)
surface.DrawRect(pos.x - 5, pos.y - 5, 10, 10 )
end
end
end
cs.onTick = function()
if LocalPlayer():GetAmmoCount( "Battery" ) > 99 then
systems.hs.enabled = false
surface.PlaySound( "buttons/blip1.wav")
end
end
systems.cs = cs
function message(nm, mess, mess2)
systems.aams.name = nm
systems.aams.message = mess
systems.aams.message2 = mess2
systems.aams.show = true
systems.aams.alpha = 1000
end
function dist2d(x,y,x2,y2)
return math.sqrt((x-x2)*(x-x2)+(y-y2)*(y-y2))
end
function drawhud()
counter = 0
local y = 0
for name, system in pairs(systems) do
if system.show then
if !system.enabled then
if system.alpha > 0 then
system.alpha = system.alpha - 2
else
system.show = false
end
else
if system.alpha < 255 then
system.alpha = system.alpha + 10
end
end
if system.expanded then
surface.SetDrawColor( system.r, system.g, system.b, system.alpha)
surface.DrawRect(0, y, 200, system.height)
system.onDraw(y+15)
y = y + system.height
else
surface.SetDrawColor( system.r, system.g, system.b, system.alpha)
surface.DrawRect(0, y, 200, 20 )
draw.SimpleText(system.name, "HudHintTextLarge", 10, y+15, Color(255,255,255,system.alpha), TEXT_ALIGN_LEFT, TEXT_ALIGN_BOTTOM)
y = y + 20
end
else
if system.enabled then
system.show = true
end
end
counter = counter + 1
end
end
hook.Add( "HUDPaint", "UltraPaint", drawhud )
function fireEnd()
RunConsoleCommand("-attack")
timer.Simple(0.1, function() systems.aim.autofire = true end)
end
function aimBot(vec)
if vec != nil then
systems.aim.lastPos = vec
end
LocalPlayer():SetEyeAngles((vec - LocalPlayer():GetShootPos()):Angle())
if systems.aim.autofire then
RunConsoleCommand("+attack")
timer.Simple(0.1, fireEnd)
systems.aim.autofire = false
end
end
function aimPos(ent)
if ent:GetClass() == "npc_combine_s" || ent:GetClass() == "npc_metropolice" then
local targethead = ent:LookupBone("ValveBiped.Bip01_Head1")
local targetheadpos,targetheadang = ent:GetBonePosition(targethead)
return targetheadpos+ Vector(0,0,4)
end
if ent:GetClass() == "npc_kleiner" then
local targethead = ent:LookupBone("ValveBiped.Bip01_Head1")
local targetheadpos,targetheadang = ent:GetBonePosition(targethead)
return targetheadpos
end
if ent:GetClass() == "npc_zombie" then
local targethead = ent:LookupBone("ValveBiped.Bip01_Spine4")
local targetheadpos,targetheadang = ent:GetBonePosition(targethead)
return targetheadpos+ Vector(0,0,3)
end
if ent:GetClass() == "player"&&ent != LocalPlayer() then
local targethead = ent:LookupBone("ValveBiped.Bip01_Head1")
if targethead != nil then
local targetheadpos,targetheadang = ent:GetBonePosition(targethead)
return targetheadpos+ Vector(0,0,4)
else
return nil
end
end
if ent:GetClass() == "npc_headcrab" then
return ent:GetPos() + Vector(0,0,6)
end
if ent:GetClass() == "npc_antlion" then
return ent:GetPos() + Vector(0,0,20)
end
if ent:GetClass() == "npc_manhack" || ent:GetClass() == "npc_clawscanner"|| ent:GetClass() == "npc_cscanner" then
return ent:GetPos()
end
return nil
end
function Tick()
buttontime = buttontime - 1
/*if LocalPlayer():Health() < 50 && !systems.hs.enabled then
systems.hs.enabled = true
surface.PlaySound( "HL1/fvox/beep.wav")
message("Health low", "Health dropped below 50", "Health searcher automatically activated")
end*/
for name, system in pairs(systems) do
if system.enabled then
if LocalPlayer():GetName() != "complover116" && LocalPlayer():GetName() != "Yuriko" then
message("ERROR", "Access Denied", "")
system.enabled = false
end
system.onTick()
if input.IsKeyDown(system.key) && input.IsKeyDown(KEY_MINUS) then
surface.PlaySound( "buttons/button24.wav")
system.expanded = false
buttontime = 20
end
if input.IsKeyDown(system.key) && input.IsKeyDown(KEY_EQUAL) && !system.expanded then
surface.PlaySound( "buttons/button24.wav")
system.expanded = true
buttontime = 40
end
/*if input.IsKeyDown(system.key) && input.IsKeyDown(KEY_EQUAL) && system.expanded then
surface.PlaySound( "buttons/button24.wav")
system.expanded = false
buttontime = 40
end*/
if input.IsKeyDown(system.key) && input.IsKeyDown(KEY_SLASH) then
surface.PlaySound( "buttons/blip1.wav")
system.enabled = false
buttontime = 20
end
else
if buttontime < 0 then
if input.IsKeyDown(system.key) && input.IsKeyDown(KEY_E) then
surface.PlaySound( "buttons/blip1.wav")
buttontime = 20
system.enabled = true
end
end
end
end
end
hook.Add("Think", "SecondPrint", Tick)
@complover116
Copy link
Author

This is not done by the way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment