Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ________ .__ .__ ____ ________
- / _____/ ____ _____ __________ _|__| _____|__| ____ ____ \ \ / /_ |
- / \ ____/ __ \\__ \\_ __ \ \/ / |/ ___/ |/ _ \ / \ \ Y / | | 4
- \ \_\ \ ___/ / __ \| | \/\ /| |\___ \| ( <_> ) | \ \ / | |
- \______ /\___ >____ /__| \_/ |__/____ >__|\____/|___| / \___/ |___|
- \/ \/ \/ \/ \/
- */
- -- Notes
- /*
- */
- if SERVER then return end
- local GB = {}
- local concommand = concommand
- local cvars = cvars
- local debug = debug
- local ents = ents
- local file = file
- local hook = hook
- local math = math
- local spawnmenu = spawnmenu
- local string = string
- local surface = surface
- local table = table
- local timer = timer
- local util = util
- local vgui = vgui
- local Angle = Angle
- local CreateClientConVar = CreateClientConVar
- local CurTime = CurTime
- local ErrorNoHalt = ErrorNoHalt
- local FrameTime = FrameTime
- local GetConVarString = GetConVarString
- local GetViewEntity = GetViewEntity
- local include = include
- local ipairs = ipairs
- local pairs = pairs
- local pcall = pcall
- local print = print
- local RunConsoleCommand = RunConsoleCommand
- local ScrH = ScrH
- local ScrW = ScrW
- local tonumber = tonumber
- local type = type
- local unpack = unpack
- local ValidEntity = IsValid
- local Vector = Vector
- local ply = LocalPlayer()
- CreateClientConVar( "gear_config_threshold", 0, true, false )
- CreateClientConVar( "gear_config_godmode", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Misc", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Consumables", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Weapons", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Ammo", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Salesman", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Generator", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Shipment", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Cash", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Legacy", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Player", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Player_Skeleton", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Player_Cham", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Holy_Gear", 0, true, false )
- CreateClientConVar( "gear_config_ESP_Player_Distance", 0, true, false )
- --tells the script when a screenshot is being taken
- CreateClientConVar( "gear_screenshot", 0, true, false )
- local colors = {}
- red = Color(255,0,0,255);
- black = Color(0,0,0,255);
- yellow = Color(255,255,0,255);
- green = Color(0,255,0,255);
- white = Color(255,255,255,255);
- blue = Color(0,0,255,255);
- cyan = Color(0,255,255,255);
- pink = Color(255,0,255,255);
- blue = Color(0,0,255,255);
- grey = Color(100,100,100,255);
- gold = Color(255,228,0,255);
- lblue = Color(155,205,248);
- lgreen = Color(174,255,0);
- iceblue = Color(116,187,251,255);
- function GearPrintMessage(msg)
- print("[GEAR]: "..msg)
- end
- concommand.Add('Gear_PrintEnts', function()
- for k, v in pairs(ents.GetAll()) do
- GearPrintMessage(v:GetClass()) end end)
- hook.Add("CreateMove","gearbhop",function(cmd)
- if bit.band( cmd:GetButtons(), IN_JUMP ) ~= 0 then
- if !LocalPlayer():IsOnGround() then
- cmd:SetButtons( bit.band( cmd:GetButtons(), bit.bnot( IN_JUMP ) ) )
- end
- end
- end)
- GearPrintMessage("Loading successful.")
- GearPrintMessage("Welcome to GearVision, Sarge.")
- GearPrintMessage("To undo the ESP suddenly disappearing type 'gear_screenshot 0' into console.")
- GearPrintMessage("Enjoy using GearVision. The bestest private cheat.")
- surface.CreateFont("DefaultSmallDropShadow", {
- font = "Tahoma",
- size = 16,
- weight = 500,
- shadow = true,
- }
- )
- -- Gearwalk aka clientside noclip
- local GW = {}
- GW.Enabled = false
- GW.ViewOrigin = Vector( 0, 0, 0 )
- GW.ViewAngle = Angle( 0, 0, 0 )
- GW.Velocity = Vector( 0, 0, 0 )
- function GW.CalcView( ply, origin, angles, fov )
- if ( !GW.Enabled ) then return end
- if ( GW.SetView ) then
- GW.ViewOrigin = origin
- GW.ViewAngle = angles
- GW.SetView = false
- end
- return { origin = GW.ViewOrigin, angles = GW.ViewAngle }
- end
- hook.Add( "CalcView", "GearWalk", GW.CalcView )
- function GW.CreateMove( cmd )
- if ( !GW.Enabled ) then return end
- local time = FrameTime()
- GW.ViewOrigin = GW.ViewOrigin + ( GW.Velocity * time )
- GW.Velocity = GW.Velocity * 0.95
- local sensitivity = 0.022
- GW.ViewAngle.p = math.Clamp( GW.ViewAngle.p + ( cmd:GetMouseY() * sensitivity ), -89, 89 )
- GW.ViewAngle.y = GW.ViewAngle.y + ( cmd:GetMouseX() * -1 * sensitivity )
- local add = Vector( 0, 0, 0 )
- local ang = GW.ViewAngle
- if ( cmd:KeyDown( IN_FORWARD ) ) then add = add + ang:Forward() end
- if ( cmd:KeyDown( IN_BACK ) ) then add = add - ang:Forward() end
- if ( cmd:KeyDown( IN_MOVERIGHT ) ) then add = add + ang:Right() end
- if ( cmd:KeyDown( IN_MOVELEFT ) ) then add = add - ang:Right() end
- if ( cmd:KeyDown( IN_JUMP ) ) then add = add + ang:Up() end
- if ( cmd:KeyDown( IN_DUCK ) ) then add = add - ang:Up() end
- add = add:GetNormal() * time * 500
- if ( cmd:KeyDown( IN_SPEED ) ) then add = add * 2 end
- GW.Velocity = GW.Velocity + add
- if ( GW.LockView == true ) then
- GW.LockView = cmd:GetViewAngles()
- end
- if ( GW.LockView ) then
- cmd:SetViewAngles( GW.LockView )
- end
- cmd:SetForwardMove( 0 )
- cmd:SetSideMove( 0 )
- cmd:SetUpMove( 0 )
- end
- hook.Add( "CreateMove", "GearWalk", GW.CreateMove )
- function GW.Toggle()
- GW.Enabled = !GW.Enabled
- GW.LockView = GW.Enabled
- GW.SetView = true
- local status = { [ true ] = "ON", [ false ] = "OFF" }
- print( "GearWalk " .. status[ GW.Enabled ] )
- end
- concommand.Add( "GW_toggle", GW.Toggle )
- concommand.Add( "GW_pos", function() print( GW.ViewOrigin ) end )
- function gearMenu()
- local gearMenuFrame = vgui.Create("DFrame")
- local PropertySheet = vgui.Create( "DPropertySheet" )
- PropertySheet:SetParent( gearMenuFrame )
- PropertySheet:SetPos( 0, 25 )
- PropertySheet:SetSize( 600, 575 )
- gearMenuFrame:SetPos((surface.ScreenWidth()/2) - 300,(surface.ScreenHeight()/2) - 300)
- gearMenuFrame:SetSize(600,600)
- gearMenuFrame:SetTitle("GearVision")
- gearMenuFrame:MakePopup()
- local SheetItemTwo = vgui.Create( "DPanel" )
- SheetItemTwo:SetPos( 25, 50 )
- SheetItemTwo:SetSize( 250, 250 )
- SheetItemTwo.Paint = function() -- Paint function
- surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
- surface.DrawRect( 0, 0, SheetItemTwo:GetWide(), SheetItemTwo:GetTall() ) -- Draw the rect
- end
- local SheetItemOne = vgui.Create( "DPanel" )
- SheetItemOne:SetPos( 25, 50 )
- SheetItemOne:SetSize( 250, 250 )
- SheetItemOne.Paint = function() -- Paint function
- surface.SetDrawColor( 50, 50, 50, 255 ) -- Set our rect color below us; we do this so you can see items added to this panel
- surface.DrawRect( 0, 0, SheetItemOne:GetWide(), SheetItemOne:GetTall() ) -- Draw the rect
- end
- local GearGodmodeToggle = vgui.Create( "DCheckBoxLabel", SheetItemOne )
- GearGodmodeToggle:SetPos( 15,15 )
- GearGodmodeToggle:SetText( "Enable Godmode" )
- GearGodmodeToggle:SetConVar( "gear_config_godmode" )
- GearGodmodeToggle:SizeToContents()
- local GearGodmodeSlider = vgui.Create( "DNumSlider", SheetItemOne )
- GearGodmodeSlider:SetPos( 15,35 )
- GearGodmodeSlider:SetSize( 250, 25 )
- GearGodmodeSlider:SetText( "Godmode HP Threshold" )
- GearGodmodeSlider:SetMin( 10 )
- GearGodmodeSlider:SetMax( 99 )
- GearGodmodeSlider:SetDecimals( 0 )
- GearGodmodeSlider:SetConVar( "gear_config_threshold" )
- local GearESPToggle = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPToggle:SetPos( 15,15 )
- GearESPToggle:SetText( "Enable Misc Item ESP" )
- GearESPToggle:SetConVar( "gear_config_ESP_Misc" )
- GearESPToggle:SizeToContents()
- local GearESPConsumables = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPConsumables:SetPos( 15,30 )
- GearESPConsumables:SetText( "Enable Medical ESP" )
- GearESPConsumables:SetConVar( "gear_config_ESP_Consumables" )
- GearESPConsumables:SizeToContents()
- local GearESPWeapons = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPWeapons:SetPos( 15,45 )
- GearESPWeapons:SetText( "Enable Weapon ESP" )
- GearESPWeapons:SetConVar( "gear_config_ESP_Weapons" )
- GearESPWeapons:SizeToContents()
- local GearESPWeapons = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPWeapons:SetPos( 15,60 )
- GearESPWeapons:SetText( "Enable Ammo ESP" )
- GearESPWeapons:SetConVar( "gear_config_ESP_Ammo" )
- GearESPWeapons:SizeToContents()
- local GearESPSalesman = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPSalesman:SetPos( 15,75 )
- GearESPSalesman:SetText( "Enable Salesman ESP" )
- GearESPSalesman:SetConVar( "gear_config_ESP_Salesman" )
- GearESPSalesman:SizeToContents()
- local GearESPGenerator = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPGenerator:SetPos( 15,90 )
- GearESPGenerator:SetText( "Enable Generator ESP" )
- GearESPGenerator:SetConVar( "gear_config_ESP_Generator" )
- GearESPGenerator:SizeToContents()
- local GearESPShipment = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPShipment:SetPos( 15,105 )
- GearESPShipment:SetText( "Enable Shipment ESP" )
- GearESPShipment:SetConVar( "gear_config_ESP_Shipment" )
- GearESPShipment:SizeToContents()
- local GearESPCash = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPCash:SetPos( 15,120 )
- GearESPCash:SetText( "Enable Cash ESP" )
- GearESPCash:SetConVar( "gear_config_ESP_Cash" )
- GearESPCash:SizeToContents()
- local GearESPPlayer = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPPlayer:SetPos( 15,200 )
- GearESPPlayer:SetText( "Enable Player ESP" )
- GearESPPlayer:SetConVar( "gear_config_ESP_Player" )
- GearESPPlayer:SizeToContents()
- local GearESPSkeleton = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPSkeleton:SetPos( 15,215 )
- GearESPSkeleton:SetText( "Enable Player Skeletons" )
- GearESPSkeleton:SetConVar( "gear_config_ESP_Player_Skeleton" )
- GearESPSkeleton:SizeToContents()
- local GearESPCham = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPCham:SetPos( 15,230 )
- GearESPCham:SetText( "Enable Player Cham" )
- GearESPCham:SetConVar( "gear_config_ESP_Player_Cham" )
- GearESPCham:SizeToContents()
- local GearESPBox = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPBox:SetPos( 15,245 )
- GearESPBox:SetText( "Enable Player Box" )
- GearESPBox:SetConVar( "gear_config_ESP_Player_Box" )
- GearESPBox:SizeToContents()
- local GearDistanceModifier = vgui.Create( "DNumSlider", SheetItemTwo )
- GearDistanceModifier:SetPos( 15,260 )
- GearDistanceModifier:SetSize( 250, 25 )
- GearDistanceModifier:SetText( "Player Distance Modifier" )
- GearDistanceModifier:SetMin( 256 )
- GearDistanceModifier:SetMax( 10000 )
- GearDistanceModifier:SetDecimals( 0 )
- GearDistanceModifier:SetConVar( "gear_config_ESP_Player_Distance" )
- local GearESPBox = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPBox:SetPos( 15,290 )
- GearESPBox:SetText( "Enable Consumable ESP" )
- GearESPBox:SetConVar( "gear_config_ESP_Holy_Gear" )
- GearESPBox:SizeToContents()
- local GearESPLegacy = vgui.Create( "DCheckBoxLabel", SheetItemTwo )
- GearESPLegacy:SetPos( 15,305 )
- GearESPLegacy:SetText( "Enable Reusables ESP" )
- GearESPLegacy:SetConVar( "gear_config_ESP_Legacy" )
- GearESPLegacy:SizeToContents()
- PropertySheet:AddSheet( "Gear Config", SheetItemOne, "gui/silkicons/user", false, false, "Configure General Settings for GearVision" )
- PropertySheet:AddSheet( "Gear ESP", SheetItemTwo, "gui/silkicons/group", false, false, "Configure the ESP for GearVision" )
- end
- concommand.Add("gearmenu", gearMenu)
- function GearDebug()
- if GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.SimpleText("GearVision Loaded", 'DefaultSmallDropShadow', 80, 50, Color(255, 150, 0, 255), 1, 1, 1)
- end
- end
- hook.Add("HUDPaint","Debug",GearDebug)
- --[[
- hook.Add( "HUDPaint", "WallhackItem", function()
- for k,v in pairs (ents.FindByClass("cw_item")) do
- if LocalPlayer():Alive() then
- local Position = ( v:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- local Dist = v:GetPos():Distance(LocalPlayer():GetPos());
- draw.DrawText( v:GetClass( ), "DefaultSmallDropShadow", Position.x, Position.y, Color( 255, 51, 204, 255 ), 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, Color( 255, 255, 255, 255 ), 1 )
- else
- end
- end
- end)
- --]] --I honestly dont even know how to toggle this, time for coffee and gmod lua wiki
- function GearGodmode()
- local dmg = ply:Health()
- local threshold = GetConVar("gear_config_threshold"):GetInt()
- if ConVarExists( "gear_config_godmode" ) and GetConVar("gear_config_godmode"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- if dmg <= threshold then
- GearPrintMessage("Warning, damage taken has fallen below threshold. Disconnecting.")
- --GearPrintMessage("Warning, damage taken has fallen below threshold. Buying HP")
- --RunConsoleCommand("say", "/buyhealth");
- RunConsoleCommand("disconnect");
- end
- else
- return nil;
- end
- end
- hook.Add("Think","SlothGodmode",GearGodmode)
- hook.Add( "HUDPaint", "WallhackCash", function()
- if ConVarExists( "gear_config_ESP_Cash" ) and GetConVar("gear_config_ESP_Cash"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,v in pairs (ents.FindByClass("cw_cash")) do
- if LocalPlayer():Alive() then
- local Position = ( v:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- local Dist = v:GetPos():Distance(LocalPlayer():GetPos());
- draw.DrawText( "$Cash$", "DefaultSmallDropShadow", Position.x, Position.y, lgreen, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, lgreen, 1 )
- else return nil;
- end
- end
- end
- end)
- hook.Add( "HUDPaint", "WallhackShipment", function()
- if ConVarExists( "gear_config_ESP_Shipment" ) and GetConVar("gear_config_ESP_Shipment"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,v in pairs (ents.FindByClass("cw_shipment")) do
- if LocalPlayer():Alive() then
- local Position = ( v:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- local Dist = v:GetPos():Distance(LocalPlayer():GetPos());
- draw.DrawText( v:GetClass( ), "DefaultSmallDropShadow", Position.x, Position.y, Color( 0, 255, 0, 255 ), 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, Color( 0, 255, 0, 255 ), 1 )
- else return nil;
- end
- end
- end
- end)
- hook.Add( "HUDPaint", "WallhackGenerator", function()
- if ConVarExists( "gear_config_ESP_Generator" ) and GetConVar("gear_config_ESP_Generator"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,v in pairs (ents.FindByClass("cw_generator")) do
- if LocalPlayer():Alive() then
- local Position = ( v:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- local Dist = v:GetPos():Distance(LocalPlayer():GetPos());
- draw.DrawText( v:GetClass( ), "DefaultSmallDropShadow", Position.x, Position.y, Color( 0, 0, 255, 255 ), 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, Color( 0, 0, 255, 255 ), 1 )
- else return nil;
- end
- end
- end
- end)
- hook.Add( "HUDPaint", "WallhackSalesman", function()
- if ConVarExists( "gear_config_ESP_Salesman" ) and GetConVar("gear_config_ESP_Salesman"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,v in pairs (ents.FindByClass("cw_salesman")) do
- if LocalPlayer():Alive() then
- local Position = ( v:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- draw.DrawText( v:GetClass( ), "DefaultSmallDropShadow", Position.x, Position.y, Color( 255, 0, 0, 255 ), 1 )
- else return nil;
- end
- end
- end
- end)
- function CreatePos(v)
- local ply = LocalPlayer()
- local center = v:LocalToWorld( v:OBBCenter() )
- local min, max = v:OBBMins(), v:OBBMaxs()
- local dim = max - min local z = max + min
- local frt = ( v:GetForward() ) * ( dim.y / 2 )
- local rgt = ( v:GetRight() ) * ( dim.x / 2 )
- local top = ( v:GetUp() ) * ( dim.z / 2 )
- local bak = ( v:GetForward() * -1 ) * ( dim.y / 2 )
- local lft = ( v:GetRight() * -1 ) * ( dim.x / 2 )
- local btm = ( v:GetUp() * -1 ) * ( dim.z / 2 )
- local s = 1
- local FRT = center + frt / s + rgt / s + top / s; FRT = FRT:ToScreen()
- local BLB = center + bak / s + lft / s + btm / s; BLB = BLB:ToScreen()
- local FLT = center + frt / s + lft / s + top / s; FLT = FLT:ToScreen()
- local BRT = center + bak / s + rgt / s + top / s; BRT = BRT:ToScreen()
- local BLT = center + bak / s + lft / s + top / s; BLT = BLT:ToScreen()
- local FRB = center + frt / s + rgt / s + btm / s; FRB = FRB:ToScreen()
- local FLB = center + frt / s + lft / s + btm / s; FLB = FLB:ToScreen()
- local BRB = center + bak / s + rgt / s + btm / s; BRB = BRB:ToScreen()
- local z = 100
- if ( v:Health() <= 50 ) then z = 100 end
- local x, y = ( ( v:Health() / 100 ) ), 1
- if ( v:Health() <= 0 ) then x = 1 end
- local FRT3 = center + frt + rgt + top / x; FRT3 = FRT3; FRT3 = FRT3:ToScreen()
- local BLB3 = center + bak + lft + btm / x; BLB3 = BLB3; BLB3 = BLB3:ToScreen()
- local FLT3 = center + frt + lft + top / x; FLT3 = FLT3; FLT3 = FLT3:ToScreen()
- local BRT3 = center + bak + rgt + top / x; BRT3 = BRT3; BRT3 = BRT3:ToScreen()
- local BLT3 = center + bak + lft + top / x; BLT3 = BLT3; BLT3 = BLT3:ToScreen()
- local FRB3 = center + frt + rgt + btm / x; FRB3 = FRB3; FRB3 = FRB3:ToScreen()
- local FLB3 = center + frt + lft + btm / x; FLB3 = FLB3; FLB3 = FLB3:ToScreen()
- local BRB3 = center + bak + rgt + btm / x; BRB3 = BRB3; BRB3 = BRB3:ToScreen()
- local x, y, z = 1.1, 0.9, 1
- local FRT2 = center + frt / y + rgt / z + top / x; FRT2 = FRT2:ToScreen()
- local BLB2 = center + bak / y + lft / z + btm / x; BLB2 = BLB2:ToScreen()
- local FLT2 = center + frt / y + lft / z + top / x; FLT2 = FLT2:ToScreen()
- local BRT2 = center + bak / y + rgt / z + top / x; BRT2 = BRT2:ToScreen()
- local BLT2 = center + bak / y + lft / z + top / x; BLT2 = BLT2:ToScreen()
- local FRB2 = center + frt / y + rgt / z + btm / x; FRB2 = FRB2:ToScreen()
- local FLB2 = center + frt / y + lft / z + btm / x; FLB2 = FLB2:ToScreen()
- local BRB2 = center + bak / y + rgt / z + btm / x; BRB2 = BRB2:ToScreen()
- local maxX = math.max( FRT.x,BLB.x,FLT.x,BRT.x,BLT.x,FRB.x,FLB.x,BRB.x )
- local minX = math.min( FRT.x,BLB.x,FLT.x,BRT.x,BLT.x,FRB.x,FLB.x,BRB.x )
- local maxY = math.max( FRT.y,BLB.y,FLT.y,BRT.y,BLT.y,FRB.y,FLB.y,BRB.y )
- local minY = math.min( FRT.y,BLB.y,FLT.y,BRT.y,BLT.y,FRB.y,FLB.y,BRB.y )
- local minYhp2 = math.min( FRT.y,BLB.y,FLT.y,BRT.y,BLT.y,FRB.y,FLB.y,BRB.y )
- local maxXhp = math.max( FRT3.x,BLB3.x,FLT3.x,BRT3.x,BLT3.x,FRB3.x,FLB3.x,BRB3.x )
- local minXhp = math.min( FRT3.x,BLB3.x,FLT3.x,BRT3.x,BLT3.x,FRB3.x,FLB3.x,BRB3.x )
- local maxYhp = math.max( FRT3.y,BLB3.y,FLT3.y,BRT3.y,BLT3.y,FRB3.y,FLB3.y,BRB3.y )
- local minYhp = math.min( FRT3.y,BLB3.y,FLT3.y,BRT3.y,BLT3.y,FRB3.y,FLB3.y,BRB3.y )
- local maxX2 = math.max( FRT2.x,BLB2.x,FLT2.x,BRT2.x,BLT2.x,FRB2.x,FLB2.x,BRB2.x )
- local minX2 = math.min( FRT2.x,BLB2.x,FLT2.x,BRT2.x,BLT2.x,FRB2.x,FLB2.x,BRB2.x )
- local maxY2 = math.max( FRT2.y,BLB2.y,FLT2.y,BRT2.y,BLT2.y,FRB2.y,FLB2.y,BRB2.y )
- local minY2 = math.min( FRT2.y,BLB2.y,FLT2.y,BRT2.y,BLT2.y,FRB2.y,FLB2.y,BRB2.y )
- return maxX, minX, maxY, minY, maxX2, minX2, maxY2, minY2, minYhp, maxYhp
- end
- function IsCloseEnough(ent)
- local dist = ent:GetPos():Distance( LocalPlayer():GetPos() )
- if( dist <= GetConVarNumber("gear_config_ESP_Player_Distance") and ent:GetPos() != Vector( 0, 0, 0 ) ) then
- return true
- end
- return false
- end
- local mat = CreateMaterial("Cham_Texture","VertexLitGeneric",{ ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$translucent"] = 1, ["$alpha"] = 1, ["$nocull"] = 1, ["$ignorez"] = 1 } );
- function Chams()
- if GetConVarNumber("gear_config_ESP_Player_Cham") == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,v in pairs(player.GetAll()) do
- local TCol = team.GetColor(v:Team())
- if IsValid(v) and v:Health() > 0 and v:Team() != TEAM_SPECTATOR and IsCloseEnough(v) then
- cam.Start3D(EyePos(),EyeAngles())
- render.SuppressEngineLighting( true )
- render.SetColorModulation( ( TCol.r * ( 1 / 255 ) ), ( TCol.g * ( 1 / 255 ) ), ( TCol.b * ( 1 / 255 ) ) )
- render.MaterialOverride( mat )
- v:DrawModel()
- render.SuppressEngineLighting( false )
- render.SetColorModulation(1,1,1)
- render.MaterialOverride( )
- v:DrawModel()
- cam.End3D()
- end
- end
- end
- end
- hook.Add( "RenderScreenspaceEffects", "Chams", Chams )
- hook.Add( "HUDPaint", "PlayerESP", function()
- if ConVarExists( "gear_config_ESP_Player" ) and GetConVar("gear_config_ESP_Player"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k,e in pairs ( player.GetAll() ) do
- if ( e:IsPlayer() and e:Alive() and e != LocalPlayer() and IsCloseEnough(e) ) then
- if e:GetActiveWeapon() != nil then
- if type(e:GetActiveWeapon()) == "Weapon" then
- if e:GetActiveWeapon() and e:GetActiveWeapon():IsValid() then
- local weapon = e:GetActiveWeapon():GetPrintName()
- local Position = ( e:GetPos() + Vector( 0,0,80 ) ):ToScreen()
- local Dist = e:GetPos():Distance(LocalPlayer():GetPos());
- local Health = e:Health()
- local Name = e:Nick()
- if e:Health() >= 90 then HPColor = Color(0,255,0,255)
- elseif e:Health() >= 70 then HPColor = Color(255,255,0,255)
- elseif e:Health() >= 50 then HPColor = Color(255,165,0,255)
- elseif e:Health() >= 30 then HPColor = Color(255,140,0,255)
- elseif e:Health() >= 20 then HPCOlor = Color(255,69,0,255)
- elseif e:Health() >= 10 then HPColor = Color(255,0,0,255)
- else HPColor = Color(255,0,0,255)
- end
- draw.DrawText( Name, "DefaultSmallDropShadow", Position.x, Position.y, team.GetColor(e:Team()), 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, team.GetColor(e:Team()), 1 )
- draw.DrawText( "H: " .. math.floor(Health), "DefaultSmallDropShadow", Position.x, Position.y + 20, HPColor, 1 )
- draw.DrawText( "W: " ..weapon, "DefaultSmallDropShadow", Position.x, Position.y + 30, team.GetColor(e:Team()), 1 )
- if e:GetFriendStatus() == "friend" then
- draw.DrawText( "[FRIEND]", "DefaultSmallDropShadow", Position.x, Position.y + 40, Color(0, 255, 0, 255), 1 )
- end
- if e:IsAdmin() then
- draw.DrawText( "[ADMIN]", "DefaultSmallDropShadow", Position.x, Position.y + 50, Color(255, 0, 0, 255), 1 )
- end
- local bones = {
- { S = "ValveBiped.Bip01_Head1", E = "ValveBiped.Bip01_Neck1" },
- { S = "ValveBiped.Bip01_Neck1", E = "ValveBiped.Bip01_Spine4" },
- { S = "ValveBiped.Bip01_Spine4", E = "ValveBiped.Bip01_Spine2" },
- { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_Spine1" },
- { S = "ValveBiped.Bip01_Spine1", E = "ValveBiped.Bip01_Spine" },
- { S = "ValveBiped.Bip01_Spine", E = "ValveBiped.Bip01_Pelvis" },
- { S = "ValveBiped.Bip01_Spine4", E = "ValveBiped.Bip01_L_UpperArm" },
- { S = "ValveBiped.Bip01_L_UpperArm", E = "ValveBiped.Bip01_L_Forearm" },
- { S = "ValveBiped.Bip01_L_Forearm", E = "ValveBiped.Bip01_L_Hand" },
- { S = "ValveBiped.Bip01_Spine4", E = "ValveBiped.Bip01_R_UpperArm" },
- { S = "ValveBiped.Bip01_R_UpperArm", E = "ValveBiped.Bip01_R_Forearm" },
- { S = "ValveBiped.Bip01_R_Forearm", E = "ValveBiped.Bip01_R_Hand" },
- { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_L_Thigh" },
- { S = "ValveBiped.Bip01_L_Thigh", E = "ValveBiped.Bip01_L_Calf" },
- { S = "ValveBiped.Bip01_L_Calf", E = "ValveBiped.Bip01_L_Foot" },
- { S = "ValveBiped.Bip01_L_Foot", E = "ValveBiped.Bip01_L_Toe0" },
- { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_R_Thigh" },
- { S = "ValveBiped.Bip01_R_Thigh", E = "ValveBiped.Bip01_R_Calf" },
- { S = "ValveBiped.Bip01_R_Calf", E = "ValveBiped.Bip01_R_Foot" },
- { S = "ValveBiped.Bip01_R_Foot", E = "ValveBiped.Bip01_R_Toe0" },
- }
- if GetConVarNumber("gear_config_ESP_Player_Skeleton") == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- for k, v in pairs( bones ) do
- local sPos, ePos = e:GetBonePosition( e:LookupBone( v.S ) ):ToScreen(), e:GetBonePosition( e:LookupBone( v.E ) ):ToScreen()
- if e:IsPlayer() and !e:IsNPC() then
- surface.SetDrawColor(team.GetColor(e:Team()))
- end
- surface.DrawLine(sPos.x,sPos.y,ePos.x,ePos.y)
- end
- end
- end
- end
- end
- end
- end
- end
- end)
- hook.Add( "HUDPaint", "WallhackCW", function()
- for k,ent in pairs (ents.FindByClass("cw_item")) do
- if LocalPlayer():Alive() and (Clockwork.entity:HasFetchedItemData(ent)) then
- local itemTable = ent:GetItemTable()
- local Position = ( ent:GetPos() + Vector( 0,0,0 ) ):ToScreen()
- local Dist = ent:GetPos():Distance(LocalPlayer():GetPos());
- if itemTable("category") == "Weapons" then
- if ConVarExists( "gear_config_ESP_Weapons" ) and GetConVar("gear_config_ESP_Weapons"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, red, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, red, 1 )
- end
- elseif itemTable("category") == "Ammunition" then
- if ConVarExists( "gear_config_ESP_Ammo" ) and GetConVar("gear_config_ESP_Ammo"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, yellow, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, yellow, 1 )
- end
- elseif itemTable("category") == "Medical" then
- if ConVarExists( "gear_config_ESP_Consumables" ) and GetConVar("gear_config_ESP_Consumables"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, green, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, green, 1 )
- end
- elseif itemTable("category") == "Consumables" then
- if ConVarExists( "gear_config_ESP_Holy_Gear" ) and GetConVar("gear_config_ESP_Holy_Gear"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, lgreen, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, lgreen, 1 )
- end
- elseif itemTable("category") == "Reusables" then
- if ConVarExists( "gear_config_ESP_Legacy" ) and GetConVar("gear_config_ESP_Legacy"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, lblue, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, lblue, 1 )
- end
- else
- if ConVarExists( "gear_config_ESP_Misc" ) and GetConVar("gear_config_ESP_Misc"):GetInt() == 1 and GetConVar("gear_screenshot"):GetInt() == 0 then
- draw.DrawText( itemTable("name").." - "..itemTable("weight").."kg", "DefaultSmallDropShadow", Position.x, Position.y, grey, 1 )
- draw.DrawText( "D: " .. math.floor(Dist), "DefaultSmallDropShadow", Position.x, Position.y + 10, grey, 1 )
- end
- end
- end
- end
- end)
- _G.render.Capture = function( data )
- if ( data.format == "jpeg" ) then
- RunConsoleCommand("gear_screenshot", "1");
- GearPrintMessage("Possible Detection, ESP hidden for your own safety")
- elseif ( data.format == "png" ) then
- RunConsoleCommand("gear_screenshot", "1");
- GearPrintMessage("Possible Detection, ESP hidden for your own safety")
- else
- RunConsoleCommand("gear_screenshot", "1");
- GearPrintMessage("Possible Detection, ESP hidden for your own safety")
- end
- end
- --[[
- GEARBOT
- CREDITS TO FAG FOR FINDING IT ON THE INTERNET CONGRATS UR GAY
- notes:
- i haven't hooked it up to gear menu, but it will have its own tab when i decide to stop being a laz-e nigger
- --]]
- local LocalPlayer = LocalPlayer
- do
- local hooks = {}
- local created = {}
- local function CallHook(self, name, args)
- if !hooks[name] then return end
- for funcName, _ in pairs(hooks[name]) do
- local func = self[funcName]
- if func then
- local ok, err = pcall(func, self, unpack(args or {}))
- if !ok then
- ErrorNoHalt(err .. "\n")
- elseif err then
- return err
- end
- end
- end
- end
- local function RandomName()
- local random = ""
- for i = 1, math.random(4, 10) do
- local c = math.random(65, 116)
- if c >= 91 && c <= 96 then c = c + 6 end
- random = random .. string.char(c)
- end
- return random
- end
- local function AddHook(self, name, funcName)
- // If we haven't got a hook for this yet, make one with a random name and store it.
- // This is so anti-cheats can't detect by hook name, and so we can remove them later.
- if !created[name] then
- local random = RandomName()
- hook.Add(name, random, function(...) return CallHook(self, name, {...}) end)
- created[name] = random
- end
- hooks[name] = hooks[name] or {}
- hooks[name][funcName] = true
- end
- local cvarhooks = {}
- local function GetCallbackTable(convar)
- local callbacks = cvars.GetConVarCallbacks(convar)
- if !callbacks then
- cvars.AddChangeCallback(convar, function() end)
- callbacks = cvars.GetConVarCallbacks(convar)
- end
- return callbacks
- end
- local function AddCVarHook(self, convar, funcName, ...)
- local hookName = "CVar_" .. convar
- if !cvarhooks[convar] then
- local random = RandomName()
- local callbacks = GetCallbackTable(convar)
- callbacks[random] = function(...)
- CallHook(self, hookName, {...})
- end
- cvarhooks[convar] = random
- end
- AddHook(self, hookName, funcName)
- end
- // Don't let other scripts remove our hooks.
- local oldRemove = hook.Remove
- function hook.Remove(name, unique)
- if created[name] == unique then return end
- oldRemove(name, unique)
- end
- // Removes all hooks, useful if reloading the script.
- local function RemoveHooks()
- for hookName, unique in pairs(created) do
- oldRemove(hookName, unique)
- end
- for convar, unique in pairs(cvarhooks) do
- local callbacks = GetCallbackTable(convar)
- callbacks[unique] = nil
- end
- end
- // Add copies the script can access.
- GB.AddHook = AddHook
- GB.AddCVarHook = AddCVarHook
- GB.CallHook = CallHook
- GB.RemoveHooks = RemoveHooks
- end
- concommand.Add("gb_reload", function()
- GB:CallHook("Shutdown")
- print("Removing hooks...")
- GB:RemoveHooks()
- GB = nil
- local info = debug.getinfo(1, "S")
- if info && info.short_src then
- if string.Left(info.short_src, 3) == "lua" then
- info.short_src = string.sub(info.short_src, 5)
- end
- print("Reloading (" .. info.short_src .. ")...")
- include(info.short_src)
- else
- print("Cannot find AutoAim file, reload manually.")
- end
- end)
- print("AutoAim loaded.")
- // ##################################################
- // MetaTables
- // ##################################################
- local function GetMeta(name)
- return table.Copy(FindMetaTable(name) or {})
- end
- local AngM = GetMeta("Angle")
- local CmdM = GetMeta("CUserCmd")
- local EntM = GetMeta("Entity")
- local PlyM = GetMeta("Player")
- local VecM = GetMeta("Vector")
- // ##################################################
- // Settings
- // ##################################################
- do
- local settings = {}
- local function SettingVar(self, name)
- return (self.SettingPrefix or "") .. string.lower(name)
- end
- local function RandomName()
- local random = ""
- for i = 1, math.random(4, 10) do
- local c = math.random(65, 116)
- if c >= 91 && c <= 96 then c = c + 6 end
- random = random .. string.char(c)
- end
- return random
- end
- local function SetSetting(name, _, new)
- if !settings[name] then return end
- local info = settings[name]
- if info.Type == "number" then
- new = tonumber(new)
- elseif info.Type == "boolean" then
- new = (tonumber(new) or 0) > 0
- end
- info.Value = new
- end
- local function CreateSetting(self, name, desc, default, misc)
- local cvar = SettingVar(self, name)
- local info = {Name = name, Desc = desc, CVar = cvar, Type = type(default), Value = default}
- for k, v in pairs(misc or {}) do
- if !info[k] then info[k] = v end
- end
- // Convert default from boolean to number.
- if type(default) == "boolean" then
- default = default and 1 or 0
- end
- if !settings[cvar] then
- local tab = cvars.GetConVarCallbacks(cvar)
- if !tab then
- cvars.AddChangeCallback(cvar, function() end)
- tab = cvars.GetConVarCallbacks(cvar)
- end
- while true do
- local name = RandomName()
- if !tab[name] then
- tab[name] = SetSetting
- info.Callback = name
- break
- end
- end
- end
- settings[cvar] = info
- settings[#settings + 1] = info
- // Create the convar.
- CreateClientConVar(cvar, default, (info.Save != false), false)
- SetSetting(cvar, _, GetConVarString(cvar))
- end
- local function GetSetting(self, name)
- local cvar = SettingVar(self, name)
- if !settings[cvar] then return end
- return settings[cvar].Value
- end
- local function Shutdown()
- print("Removing settings callbacks...")
- for _, info in ipairs(settings) do
- if info.CVar && info.Callback then
- local tab = cvars.GetConVarCallbacks(info.CVar)
- if tab then
- tab[info.Callback] = nil
- end
- end
- end
- end
- local function SettingsList()
- return table.Copy(settings)
- end
- local function BuildMenu(self, panel)
- for _, info in ipairs(settings) do
- if info.Show != false then
- if info.MultiChoice then
- local m = panel:MultiChoice(info.Desc or info.CVar, info.CVar)
- for k, v in pairs(info.MultiChoice) do
- m:AddChoice(k, v)
- end
- elseif info.Type == "number" then
- panel:NumSlider(info.Desc or info.CVar, info.CVar, info.Min or -1, info.Max or -1, info.Places or 0)
- elseif info.Type == "boolean" then
- panel:CheckBox(info.Desc or info.CVar, info.CVar)
- elseif info.Type == "string" then
- panel:TextEntry(info.Desc or info.CVar, info.CVar)
- end
- end
- end
- end
- GB.SettingPrefix = "gb_"
- GB.CreateSetting = CreateSetting
- GB.Setting = GetSetting
- GB.SettingsList = SettingsList
- GB.BuildMenu = BuildMenu
- GB.SettingsShutdown = Shutdown
- GB:AddHook("Shutdown", "SettingsShutdown")
- end
- // ##################################################
- // Targetting - Positions
- // ##################################################
- GB.ModelTarget = {}
- function GB:SetModelTarget(model, targ)
- self.ModelTarget[model] = targ
- end
- function GB:BaseTargetPosition(ent)
- // The eye attachment is a lot more stable than bones for players.
- if type(ent) == "Player" then
- local head = EntM["LookupAttachment"](ent, "eyes")
- if head then
- local pos = EntM["GetAttachment"](ent, head)
- if pos then
- return pos.Pos - (AngM["Forward"](pos.Ang) * 2)
- end
- end
- end
- // Check if the model has a special target assigned to it.
- local special = self.ModelTarget[string.lower(EntM["GetModel"](ent) or "")]
- if special then
- // It's a string - look for a bone.
- if type(special) == "string" then
- local bone = EntM["LookupBone"](ent, special)
- if bone then
- local pos = EntM["GetBonePosition"](ent, bone)
- if pos then
- return pos
- end
- end
- // It's a Vector - return a relative position.
- elseif type(special) == "Vector" then
- return EntM["LocalToWorld"](ent, special)
- // It's a function - do something fancy!
- elseif type(special) == "function" then
- local pos = pcall(special, ent)
- if pos then return pos end
- end
- end
- // Try and use the head bone, found on all of the player + human models.
- local bone = "ValveBiped.Bip01_Head1"
- local head = EntM["LookupBone"](ent, bone)
- if head then
- local pos = EntM["GetBonePosition"](ent, head)
- if pos then
- return pos
- end
- end
- // Give up and return the center of the entity.
- return EntM["LocalToWorld"](ent, EntM["OBBCenter"](ent))
- end
- function GB:TargetPosition(ent)
- local targetPos = self:BaseTargetPosition(ent)
- local ply = LocalPlayer()
- if ValidEntity(ply) then
- targetPos = self:CallHook("TargetPrediction", {ply, ent, targetPos}) or targetPos
- end
- return targetPos
- end
- GB:SetModelTarget("models/crow.mdl", Vector(0, 0, 5)) // Crow.
- GB:SetModelTarget("models/pigeon.mdl", Vector(0, 0, 5)) // Pigeon.
- GB:SetModelTarget("models/seagull.mdl", Vector(0, 0, 6)) // Seagull.
- GB:SetModelTarget("models/combine_scanner.mdl", "Scanner.Body") // Scanner.
- GB:SetModelTarget("models/hunter.mdl", "MiniStrider.body_joint") // Hunter.
- GB:SetModelTarget("models/combine_turrets/floor_turret.mdl", "Barrel") // Turret.
- GB:SetModelTarget("models/dog.mdl", "Dog_Model.Eye") // Dog.
- GB:SetModelTarget("models/vortigaunt.mdl", "ValveBiped.Head") // Vortigaunt.
- GB:SetModelTarget("models/antlion.mdl", "Antlion.Body_Bone") // Antlion.
- GB:SetModelTarget("models/antlion_guard.mdl", "Antlion_Guard.Body") // Antlion guard.
- GB:SetModelTarget("models/antlion_worker.mdl", "Antlion.Head_Bone") // Antlion worker.
- GB:SetModelTarget("models/zombie/fast_torso.mdl", "ValveBiped.HC_BodyCube") // Fast zombie torso.
- GB:SetModelTarget("models/zombie/fast.mdl", "ValveBiped.HC_BodyCube") // Fast zombie.
- GB:SetModelTarget("models/headcrabclassic.mdl", "HeadcrabClassic.SpineControl") // Normal headcrab.
- GB:SetModelTarget("models/headcrabblack.mdl", "HCBlack.body") // Poison headcrab.
- GB:SetModelTarget("models/headcrab.mdl", "HCFast.body") // Fast headcrab.
- GB:SetModelTarget("models/zombie/poison.mdl", "ValveBiped.Headcrab_Cube1") // Poison zombie.
- GB:SetModelTarget("models/zombie/classic.mdl", "ValveBiped.HC_Body_Bone") // Zombie.
- GB:SetModelTarget("models/zombie/classic_torso.mdl", "ValveBiped.HC_Body_Bone") // Zombie torso.
- GB:SetModelTarget("models/zombie/zombie_soldier.mdl", "ValveBiped.HC_Body_Bone") // Zombine.
- GB:SetModelTarget("models/combine_strider.mdl", "Combine_Strider.Body_Bone") // Strider.
- GB:SetModelTarget("models/combine_dropship.mdl", "D_ship.Spine1") // Combine dropship.
- GB:SetModelTarget("models/combine_helicopter.mdl", "Chopper.Body") // Combine helicopter.
- GB:SetModelTarget("models/gunship.mdl", "Gunship.Body") // Combine gunship.
- GB:SetModelTarget("models/lamarr.mdl", "HeadcrabClassic.SpineControl") // Lamarr!
- GB:SetModelTarget("models/mortarsynth.mdl", "Root Bone") // Mortar synth.
- GB:SetModelTarget("models/synth.mdl", "Bip02 Spine1") // Synth.
- GB:SetModelTarget("models/vortigaunt_slave.mdl", "ValveBiped.Head") // Vortigaunt slave.
- // ##################################################
- // Targetting - General
- // ##################################################
- GB.NPCDeathSequences = {}
- function GB:AddNPCDeathSequence(model, sequence)
- self.NPCDeathSequences = self.NPCDeathSequences or {}
- self.NPCDeathSequences[model] = self.NPCDeathSequences[model] or {}
- if !table.HasValue(self.NPCDeathSequences[model]) then
- table.insert(self.NPCDeathSequences[model], sequence)
- end
- end
- GB:AddNPCDeathSequence("models/barnacle.mdl", 4)
- GB:AddNPCDeathSequence("models/barnacle.mdl", 15)
- GB:AddNPCDeathSequence("models/antlion_guard.mdl", 44)
- GB:AddNPCDeathSequence("models/hunter.mdl", 124)
- GB:AddNPCDeathSequence("models/hunter.mdl", 125)
- GB:AddNPCDeathSequence("models/hunter.mdl", 126)
- GB:AddNPCDeathSequence("models/hunter.mdl", 127)
- GB:AddNPCDeathSequence("models/hunter.mdl", 128)
- GB:CreateSetting("friendlyfire", "Target teammates", false)
- function GB:IsValidTarget(ent)
- // We only want players/NPCs.
- local typename = type(ent)
- if typename != "NPC" && typename != "Player" then return false end
- // No invalid entities.
- if !ValidEntity(ent) then return false end
- // Go shoot yourself, emo kid.
- local ply = LocalPlayer()
- if ent == ply then return false end
- if typename == "Player" then
- if !PlyM["Alive"](ent) then return false end // Dead players FTL.
- if !self:Setting("friendlyfire") && PlyM["Team"](ent) == PlyM["Team"](ply) then return false end
- if EntM["GetMoveType"](ent) == MOVETYPE_OBSERVER then return false end // No spectators.
- if EntM["GetMoveType"](ent) == MOVETYPE_NONE then return false end
- //if pl["Team"](ent) == 1001 then return false end
- end
- if typename == "NPC" then
- if EntM["GetMoveType"](ent) == MOVETYPE_NONE then return false end // No dead NPCs.
- // No dying NPCs.
- local model = string.lower(EntM["GetModel"](ent) or "")
- if table.HasValue(self.NPCDeathSequences[model] or {}, EntM["GetSequence"](ent)) then return false end
- end
- end
- GB:CreateSetting("predictblocked", "Predict blocked (time)", 0.4, {Min = 0, Max = 1})
- function GB:BaseBlocked(target, offset)
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- // Trace from the players shootpos to the position.
- local shootPos = PlyM["GetShootPos"](ply)
- local targetPos = self:TargetPosition(target)
- if offset then targetPos = targetPos + offset end
- local trace = util.TraceLine({start = shootPos, endpos = targetPos, filter = {ply, target}, mask = MASK_SHOT})
- local wrongAim = self:AngleBetween(PlyM["GetAimVector"](ply), VecM["GetNormal"](targetPos - shootPos)) > 2
- // If we hit something, we're "blocked".
- if trace.Hit && trace.Entity != target then
- return true, wrongAim
- end
- // It is not blocked.
- return false, wrongAim
- end
- function GB:TargetBlocked(target)
- if !target then target = self:GetTarget() end
- if !target then return end
- local blocked, wrongAim = self:BaseBlocked(target)
- if self:Setting("predictblocked") > 0 && blocked then
- blocked = self:BaseBlocked(target, EntM["GetVelocity"](target) * self:Setting("predictblocked"))
- end
- return blocked, wrongAim
- end
- function GB:SetTarget(ent)
- if self.Target && !ent then
- self:CallHook("TargetLost")
- elseif !self.Target && ent then
- self:CallHook("TargetGained")
- elseif self.Target && ent && self.Target != ent then
- self:CallHook("TargetChanged")
- end
- self.Target = ent
- end
- function GB:GetTarget()
- if ValidEntity(self.Target) != false then
- return self.Target
- else
- return false
- end
- end
- GB:CreateSetting("maxangle", "Max angle", 30, {Min = 5, Max = 90})
- GB:CreateSetting("targetblocked", "Don't check LOS", false)
- GB:CreateSetting("holdtarget", "Hold targets", false)
- function GB:FindTarget()
- if !self:Enabled() then return end
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- local maxAng = self:Setting("maxangle")
- local aimVec, shootPos = PlyM["GetAimVector"](ply), PlyM["GetShootPos"](ply)
- local targetBlocked = self:Setting("targetblocked")
- if self:Setting("holdtarget") then
- local target = self:GetTarget()
- if target then
- local targetPos = self:TargetPosition(target)
- local angle = self:AngleBetween(AngM["Forward"](self:GetView()), VecM["GetNormal"](targetPos - shootPos))
- local blocked = self:TargetBlocked(target)
- if angle <= maxAng && (!blocked || targetBlocked) then return end
- end
- end
- // Filter out targets.
- local targets = ents.GetAll()
- for i, ent in pairs(targets) do
- if self:IsValidTarget(ent) == false then
- targets[i] = nil
- end
- end
- local closestTarget, lowestAngle = _, maxAng
- for _, target in pairs(targets) do
- if targetBlocked || !self:TargetBlocked(target) then
- local targetPos = self:TargetPosition(target)
- local angle = self:AngleBetween(AngM["Forward"](self:GetView()), VecM["GetNormal"](targetPos - shootPos))
- if angle < lowestAngle then
- lowestAngle = angle
- closestTarget = target
- end
- end
- end
- self:SetTarget(closestTarget)
- end
- GB:AddHook("Think", "FindTarget")
- // ##################################################
- // Fake view
- // ##################################################
- GB.View = Angle(0, 0, 0)
- function GB:GetView()
- return self.View * 1
- end
- function GB:KeepView()
- if !self:Enabled() then return end
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- self.View = EntM["EyeAngles"](ply)
- end
- GB:AddHook("OnToggled", "KeepView")
- local sensitivity = 0.022
- function GB:RotateView(cmd)
- self.View.p = math.Clamp(self.View.p + (CmdM["GetMouseY"](cmd) * sensitivity), -89, 89)
- self.View.y = math.NormalizeAngle(self.View.y + (CmdM["GetMouseX"](cmd) * sensitivity * -1))
- end
- GB:CreateSetting("debug", "Debug", false, {Show = false})
- function GB:FakeView(ply, origin, angles, FOV)
- if !self:Enabled() && !self.SetAngleTo then return end
- if GetViewEntity() != LocalPlayer() then return end
- if self:Setting("debug") then return end
- local base = GAMEMODE:CalcView(ply, origin, self.SetAngleTo or self.View, FOV) or {}
- base.angles = base.angles or (self.AngleTo or self.View)
- base.angles.r = 0 // No crappy screen tilting in ZS.
- return base
- end
- GB:AddHook("CalcView", "FakeView")
- function GB:TargetPrediction(ply, target, targetPos)
- local weap = PlyM["GetActiveWeapon"](ply)
- if ValidEntity(weap) then
- local class = EntM["GetClass"](weap)
- if class == "weapon_crossbow" then
- local dist = VecM["Length"](targetPos - PlyM["GetShootPos"](ply))
- local time = (dist / 3500) + 0.05 // About crossbow bolt speed.
- targetPos = targetPos + (EntM["GetVelocity"](target) * time)
- end
- local mul = 0.0075
- //targetPos = targetPos - (e["GetVelocity"](ply) * mul)
- end
- return targetPos
- end
- GB:AddHook("TargetPrediction", "TargetPrediction")
- // ##################################################
- // Aim
- // ##################################################
- function GB:SetAngle(ang)
- self.SetAngleTo = ang
- end
- GB:CreateSetting("smoothspeed", "Smooth aim speed (0 to disable)", 120, {Min = 0, Max = 360})
- GB:CreateSetting("snaponfire", "Snap on fire", true)
- GB:CreateSetting("snapgrace", "Snap on fire grace", 0.5, {Min = 0, Max = 3, Places = 1})
- GB.LastAttack = 0
- function GB:SetAimAngles(cmd)
- self:RotateView(cmd)
- if !self:Enabled() && !self.SetAngleTo then return end
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- // We're aiming with the view, normally.
- local targetAim = self:GetView()
- // If we have a target, aim at them!
- local target = self:GetTarget()
- if target then
- local targetPos = self:TargetPosition(target)
- targetAim = VecM["Angle"](targetPos - ply:GetShootPos())
- end
- // We're following the view, until we fire.
- if self:Setting("snaponfire") then
- local time = CurTime()
- if PlyM["KeyDown"](ply, IN_ATTACK) || PlyM["KeyDown"](ply, IN_ATTACK2) || self:Setting("autoshoot") != 0 then
- self.LastAttack = time
- end
- if CurTime() - self.LastAttack > self:Setting("snapgrace") then
- targetAim = self:GetView()
- end
- end
- // We want to change to whatever was SetAngle'd.
- if self.SetAngleTo then
- targetAim = self.SetAngleTo
- end
- // Smooth aiming.
- local smooth = self:Setting("smoothspeed")
- if smooth > 0 then
- local current = CmdM["GetViewAngles"](cmd)
- // Approach the target angle.
- current = self:ApproachAngle(current, targetAim, smooth * FrameTime())
- current.r = 0
- // If we're just following the view, we don't need to smooth it.
- if self.RevertingAim then
- local diff = self:NormalizeAngle(current - self:GetView())
- if math.abs(diff.p) < 1 && math.abs(diff.y) < 1 then self.RevertingAim = false end
- elseif targetAim == self:GetView() then
- current = targetAim
- end
- // Check if the angles are the same...
- if self.SetAngleTo then
- local diff = self:NormalizeAngle(current - self.SetAngleTo)
- if math.abs(diff.p) < 1 && math.abs(diff.y) < 1 then self.SetAngleTo = nil end
- end
- aim = current
- else
- aim = targetAim
- self.SetAngleTo = nil
- end
- // Set the angles.
- CmdM["SetViewAngles"](cmd, aim)
- local sensitivity = 0.22
- local diff = aim - CmdM["GetViewAngles"](cmd)
- CmdM["SetMouseX"](cmd, diff.y / sensitivity)
- CmdM["SetMouseY"](cmd, diff.p / sensitivity)
- // Change the players movement to be relative to their view instead of their aim.
- local move = Vector(CmdM["GetForwardMove"](cmd), CmdM["GetSideMove"](cmd), 0)
- local norm = VecM["GetNormal"](move)
- local set = AngM["Forward"](VecM["Angle"](norm) + (aim - self:GetView())) * VecM["Length"](move)
- CmdM["SetForwardMove"](cmd, set.x)
- CmdM["SetSideMove"](cmd, set.y)
- end
- GB:AddHook("CreateMove", "SetAimAngles")
- function GB:RevertAim()
- self.RevertingAim = true
- end
- GB:AddHook("TargetLost", "RevertAim")
- function GB:StopRevertAim()
- self.RevertingAim = false
- end
- GB:AddHook("TargetGained", "RevertAim")
- // When we turn off the bot, we want our aim to go back to our view.
- function GB:ViewToAim()
- if self:Enabled() then return end
- self:SetAngle(self:GetView())
- end
- GB:AddHook("OnToggled", "ViewToAim")
- // ##################################################
- // HUD
- // ##################################################
- GB:CreateSetting("crosshair", "Crosshair size (0 to disable)", 18, {Min = 0, Max = 20})
- function GB:DrawTarget()
- if !self:Enabled() then return end
- local target = self:GetTarget()
- if !target then return end
- local size = self:Setting("crosshair")
- if size <= 0 then return end
- // Change colour on the block status.
- local blocked, aimOff = self:TargetBlocked()
- if blocked then
- if GetConVar("gear_screenshot"):GetInt() == 0 then
- surface.SetDrawColor(255, 0, 0, 255) // Red.
- end
- elseif aimOff then
- if GetConVar("gear_screenshot"):GetInt() == 0 then
- surface.SetDrawColor(255, 255, 0, 255) // Yellow.
- else
- surface.SetDrawColor(0, 255, 0, 255) // Green.
- end
- end
- // Get the onscreen coordinates for the target.
- local pos = self:TargetPosition(target)
- local screen = VecM["ToScreen"](pos)
- local x, y = screen.x, screen.y
- // Work out sizes.
- local a, b = size / 2, size / 6
- if GetConVar("gear_screenshot"):GetInt() == 0 then
- // Top left.
- surface.DrawLine(x - a, y - a, x - b, y - a)
- surface.DrawLine(x - a, y - a, x - a, y - b)
- // Bottom right.
- surface.DrawLine(x + a, y + a, x + b, y + a)
- surface.DrawLine(x + a, y + a, x + a, y + b)
- // Top right.
- surface.DrawLine(x + a, y - a, x + b, y - a)
- surface.DrawLine(x + a, y - a, x + a, y - b)
- // Bottom left.
- surface.DrawLine(x - a, y + a, x - b, y + a)
- surface.DrawLine(x - a, y + a, x - a, y + b)
- end
- end
- GB:AddHook("HUDPaint", "DrawTarget")
- GB.ScreenMaxAngle = {
- Length = 0,
- FOV = 0,
- MaxAngle = 0
- }
- GB:CreateSetting("draw_maxangle", "Draw Max Angle", true)
- function GB:DrawMaxAngle()
- if !self:Enabled() then return end
- // Check that we want to be drawing this...
- local show = GB:Setting("draw_maxangle")
- if !show then return end
- // We need a player for this to work...
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- local info = self.ScreenMaxAngle
- local maxang = GB:Setting("maxangle")
- local fov = PlyM["GetFOV"](ply)
- if GetViewEntity() == ply && (maxang != info.MaxAngle || fov != info.FOV) then
- local view = self:GetView()
- view.p = view.p + maxang
- local screen = (PlyM["GetShootPos"](ply) + (AngM["Forward"](view) * 100))
- screen = VecM["ToScreen"](screen)
- info.Length = math.abs((ScrH() / 2) - screen.y)
- info.MaxAngle = maxang
- info.FOV = fov
- end
- local length = info.Length
- local cx, cy = ScrW() / 2, ScrH() / 2
- for x = -1, 1 do
- for y = -1, 1 do
- if x != 0 || y != 0 then
- if GetConVar("gear_screenshot"):GetInt() == 0 then
- local add = VecM["GetNormal"](Vector(x, y, 0)) * length
- surface.SetDrawColor(0, 0, 0, 255)
- surface.DrawRect((cx + add.x) - 2, (cy + add.y) - 2, 5, 5)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawRect((cx + add.x) - 1, (cy + add.y) - 1, 3, 3)
- end
- end
- end
- end
- end
- GB:AddHook("HUDPaint", "DrawMaxAngle")
- // ##################################################
- // Auto-shoot
- // ##################################################
- GB.AttackDown = false
- function GB:SetShooting(bool)
- if self.AttackDown == bool then return end
- self.AttackDown = bool
- local pre = {[true] = "+", [false] = "-"}
- RunConsoleCommand(pre[bool] .. "attack")
- end
- GB.NextShot = 0
- GB:CreateSetting("autoshoot", "Max auto-shoot distance (0 to disable)", 0, {Min = 0, Max = 16384})
- function GB:Shoot()
- if !self:Enabled() then
- self:SetShooting(false)
- return
- end
- // Get the maximum distance.
- local maxDist = self:Setting("autoshoot")
- if maxDist == 0 then return end
- // Check we've got something to shoot at...
- local target = self:GetTarget()
- if !target then return end
- // Don't shoot until we can hit, you idiot!
- local blocked, wrongAim = self:TargetBlocked(target)
- if blocked || wrongAim then return end
- // We're gonna need the player object in a second.
- local ply = LocalPlayer()
- if !ValidEntity(ply) then return end
- // Check we're within our maximum distance.
- local targetPos = self:TargetPosition(target)
- local distance = VecM["Length"](targetPos - ply:GetShootPos())
- if distance > maxDist && maxDist != -1 then return end
- // Check if it's time to shoot yet.
- if CurTime() < self.NextShot then return end
- // Check we got our weapon.
- local weap = PlyM["GetActiveWeapon"](ply)
- if !ValidEntity(weap) then return end
- // Shoot!
- self:SetShooting(true)
- // If we're semi-auto, we want to stop holding down fire.
- if self:IsSemiAuto(weap) then
- timer.Simple(0.05, function() self:SetShooting(false) end)
- end
- // Set the next time to shoot.
- self.NextShot = CurTime() + 0.1
- end
- GB:AddHook("Think", "Shoot")
- // When we lose our target we stop shooting.
- function GB:StopShooting()
- self:SetShooting(false)
- end
- GB:AddHook("TargetLost", "StopShooting")
- // ##################################################
- // Toggle
- // ##################################################
- GB.IsEnabled = false
- function GB:Enabled() return self.IsEnabled end
- function GB:SetEnabled(bool)
- if self.IsEnabled == bool then return end
- self.IsEnabled = bool
- local message = {[true] = "ON", [false] = "OFF"}
- print("AutoAim " .. message[self.IsEnabled])
- local e = {[true] = "1", [false] = "0"}
- RunConsoleCommand("gb_enabled", e[self.IsEnabled])
- self:CallHook("OnToggled")
- end
- function GB:Toggle()
- self:SetEnabled(!self:Enabled())
- end
- concommand.Add("gb_toggle", function() GB:Toggle() end)
- GB:CreateSetting("enabled", "Enabled", false, {Save = false})
- function GB:ConVarEnabled(_, old, val)
- if old == val then return end
- val = tonumber(val) or 0
- self:SetEnabled(val > 0)
- end
- GB:AddCVarHook("gb_enabled", "ConVarEnabled")
- concommand.Add("+GB", function() GB:SetEnabled(true) end)
- concommand.Add("-GB", function() GB:SetEnabled(false) end)
- // ##################################################
- // Menu
- // ##################################################
- function GB:OpenMenu()
- local w, h = ScrW() / 3, ScrH() / 2
- local menu = vgui.Create("DFrame")
- menu:SetTitle("AutoAim")
- menu:SetSize(w, h)
- menu:Center()
- menu:MakePopup()
- local scroll = vgui.Create("DPanelList", menu)
- scroll:SetPos(5, 25)
- scroll:SetSize(w - 10, h - 30)
- scroll:EnableVerticalScrollbar()
- local form = vgui.Create("DForm", menu)
- form:SetName("")
- form.Paint = function() end
- scroll:AddItem(form)
- self:BuildMenu(form)
- if GB.Menu then GB.Menu:Remove() end
- GB.Menu = menu
- end
- concommand.Add("gb_menu", function() GB:OpenMenu() end)
- function GB:RegisterMenu()
- spawnmenu.AddToolMenuOption("Options", "Hacks", "AutoAim", "AutoAim", "", "", function(p) self:BuildMenu(p) end)
- end
- GB:AddHook("PopulateToolMenu", "RegisterMenu")
- // ##################################################
- // Useful functions
- // ##################################################
- function GB:AngleBetween(a, b)
- return math.deg(math.acos(VecM["Dot"](a, b)))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement