Advertisement
nervee

GAYBO Revision 3

Sep 23rd, 2014
2,094
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 45.75 KB | None | 0 0
  1.     -- [[                       ]] --
  2.     -- --   GAYBO Revision 3    -- --
  3.     -- ]]                       [[ --
  4.  
  5.     // 9/23/2014: Fixed typo "Mouse Keys" > "Mouse Buttons"
  6.     // 9/23/2014: Omitted HideScreen variable, cleaned up DrawMisc library
  7.     // 9/23/2014: Cleaned up various code
  8.     // 12/2/2014: Fixed player validity when the player is a number, fixed panels not opening correctly
  9.     // 1/2/2015: Fixed incorrect usage of "or" operator
  10.     // 1/2/2015: Fixed aim_priority angle not working correctly
  11.  
  12.     // Change both of the change_me_please's to something else
  13.     local CHANGE_ME1 = "change_me_please"
  14.     local CHANGE_ME2 = "change_me_please"
  15.    
  16.     // Localize libraries for speed
  17.     local achievements   = achievements
  18.     local cam            = cam
  19.    local chat           = chat
  20.     local cleanup        = cleanup
  21.     local concommand     = concommand
  22.     local constraint     = constraint
  23.     local controlpanel   = controlpanel
  24.     local cookie         = cookie
  25.     local coroutine      = coroutine
  26.     local cvars          = cvars
  27.     local debugoverlay   = debugoverlay
  28.     local debug          = debug   
  29.     local duplicator     = duplicator
  30.     local ents           = ents
  31.     local file           = file
  32.     local gamemode       = gamemode
  33.     local game           = game
  34.     local gmod           = gmod
  35.     local gui            = gui
  36.     local hook           = hook
  37.     local http           = http
  38.     local input          = input
  39.     local killicon       = killicon
  40.     local language       = language
  41.     local list           = list
  42.     local markup         = markup
  43.     local mesh           = mesh
  44.     local net            = net
  45.     local notification   = notification
  46.     local os             = os
  47.     local package        = package
  48.     local physenv        = physenv
  49.     local player_manager = player_manager
  50.     local player         = player
  51.     local presets        = presets
  52.     local render         = render
  53.     local resource       = resource
  54.     local saverestore    = saverestore
  55.     local scripted_ents  = scripted_ents
  56.     local spawnmenu      = spawnmenu
  57.     local sql            = sql
  58.     local string         = string
  59.     local surface        = surface
  60.     local table          = table
  61.     local team           = team
  62.     local timer          = timer
  63.     local undo           = undo
  64.     local usermessage    = usermessage
  65.     local util           = util
  66.     local vgui           = vgui
  67.     local weapons        = weapons
  68.    
  69.     // Localize some global functions (not all of them obviously)
  70.    local Angle                = Angle
  71.    local Color                = Color
  72.    local EyeAngles            = EyeAngles
  73.    local EyePos               = EyePos
  74.    local ipairs               = ipairs
  75.    local pairs                = pairs
  76.    local tobool               = tobool
  77.    local tonumber             = tonumber
  78.    local tostring             = tostring
  79.    local type                 = type
  80.    local unpack               = unpack
  81.    local Vector               = Vector
  82.     local Msg                  = Msg
  83.    local MsgN                 = MsgN
  84.    local IsValid              = IsValid
  85.    local RealFrameTime        = RealFrameTime
  86.    local CreateClientConVar   = CreateClientConVar
  87.    local CreateMaterial       = CreateMaterial
  88.     local AddConsoleCommand    = AddConsoleCommand 
  89.     local next                 = next
  90.     local Entity               = Entity
  91.     local rawget               = rawget
  92.     local pcall                = pcall
  93.     local FindMetaTable        = FindMetaTable
  94.     local HSVToColor           = HSVToColor
  95.     local ScrW                 = ScrW
  96.     local ScrH                 = ScrH
  97.     local RealTime             = RealTime
  98.     local LocalPlayer          = LocalPlayer
  99.     local LerpAngle            = LerpAngle
  100.     local GetConVarNumber      = GetConVarNumber
  101.     local collectgarbage       = collectgarbage
  102.    
  103.     // Localize masks
  104.     local MASK_SHOT                  = MASK_SHOT
  105.     local MASK_SHOT_PORTAL           = MASK_SHOT_PORTAL
  106.     local MASK_SOLID                 = MASK_SOLID
  107.     local MASK_PLAYERSOLID           = MASK_PLAYERSOLID
  108.     local MASK_ALL                   = MASK_ALL
  109.     local MASK_OPAQUE                = MASK_OPAQUE
  110.     local MASK_OPAQUE_AND_NPCS       = MASK_OPAQUE_AND_NPCS
  111.     local MASK_SPLITAREAPORTAL       = MASK_SPLITAREAPORTAL
  112.     local MASK_BLOCKLOS_AND_NPCS     = MASK_BLOCKLOS_AND_NPCS
  113.     local MASK_VISIBLE               = MASK_VISIBLE
  114.     local MASK_NPCSOLID              = MASK_NPCSOLID
  115.     local MASK_BLOCKLOS              = MASK_BLOCKLOS
  116.     local MASK_NPCSOLID_BRUSHONLY    = MASK_NPCSOLID_BRUSHONLY
  117.     local MASK_VISIBLE_AND_NPCS      = MASK_VISIBLE_AND_NPCS
  118.     local MASK_NPCWORLDSTATIC        = MASK_NPCWORLDSTATIC
  119.     local MASK_CURRENT               = MASK_CURRENT
  120.     local MASK_DEADSOLID             = MASK_DEADSOLID
  121.     local MASK_SOLID_BRUSHONLY       = MASK_SOLID_BRUSHONLY
  122.     local MASK_SHOT_HULL             = MASK_SHOT_HULL
  123.     local MASK_WATER                 = MASK_WATER
  124.     local MASK_PLAYERSOLID_BRUSHONLY = MASK_PLAYERSOLID_BRUSHONLY
  125.    
  126.     // Localize meta stuff (cause we can)
  127.     local __eq        = __eq
  128.     local __tostring  = __tostring
  129.     local __gc        = __mul
  130.     local __index     = __index
  131.     local __concat    = __concat
  132.     local __newindex  = __newindex
  133.     local __add       = __add
  134.     local __sub       = __sub
  135.     local __div       = __div
  136.     local __call      = __call
  137.     local __pow       = __pow
  138.     local __unm       = __unm
  139.     local __lt        = __lt
  140.     local __le        = __le
  141.     local __mode      = __mode
  142.     local __metatable = __metatable
  143.    
  144.     // IN Locals
  145.     local IN_JUMP = IN_JUMP
  146.    
  147.     // Old copies at the top for convenience
  148.     local old_render = render
  149.     local old_debug = debug
  150.     local old_hook = hook
  151.    
  152.     local old_entmeta  = FindMetaTable( "Entity" )
  153.     local old_plymeta  = FindMetaTable( "Player" )
  154.     local old_cusercmd = FindMetaTable( "CUserCmd" )
  155.    
  156.     // Random locals
  157.     local loop               = next
  158.     local abs                = math.abs
  159.     local gsub               = string.gsub
  160.     local insert             = table.insert
  161.     local gmatch             = string.gmatch
  162.     local GetAll             = player.GetAll
  163.     local TraceLine          = util.TraceLine
  164.     local RoundedBox         = draw.RoundedBox
  165.     local SetFont            = surface.SetFont
  166.     local DrawText           = surface.DrawText
  167.     local SetTextPos         = surface.SetTextPos
  168.     local SetMaterial        = surface.SetMaterial
  169.     local SetTextColor       = surface.SetTextColor
  170.     local SetDrawColor       = surface.SetDrawColor
  171.     local AngleDifference    = math.AngleDifference
  172.     local MaterialOverride   = render.MaterialOverride
  173.     local DrawTexturedRect   = surface.DrawTexturedRect
  174.     local DrawOutlinedRect   = surface.DrawOutlinedRect
  175.     local SetColorModulation = render.SetColorModulation
  176.    
  177.     local G = {
  178.         [ "HookFuncs" ] = {},
  179.         [ "Hooks" ] = {},
  180.         //[ "Detours" ] = {},
  181.         [ "FAV" ] = {},
  182.         [ "AimbotWaste" ] = {},
  183.         [ "BindSystem" ] = {},
  184.         [ "Keys" ] = {},
  185.         [ "Menu" ] = {},
  186.         [ "Console" ] = {},
  187.         [ "Library" ] = {},
  188.         [ "DrawConsole" ] = {},
  189.         [ "Panels" ] = {},
  190.         [ "Theme" ] = {},
  191.         //[ "HitboxFix" ] = {}
  192.     }
  193.    
  194.     local __G = table.Copy( _G ) // Yay for copies I will never use
  195.     local __R = table.Copy( debug.getregistry() )
  196.    
  197.     // Theme tables
  198.     G.Theme.Panel = {}
  199.    
  200.     // Panels
  201.     G.Panels[ "SettingsMenu" ] = {
  202.         Panel = {},
  203.         Frame = {},
  204.         Settings = {}
  205.     }
  206.    
  207.     G.Panels[ "Console" ] = {
  208.         Panel = {},
  209.         Frame = {},
  210.         TextBox = {}
  211.     }
  212.    
  213.     G.HookFuncs = {
  214.         [ "HUDPaint" ] = {},
  215.         [ "CreateMove" ] = {},
  216.         [ "Think" ] = {},
  217.         [ "PrePlayerDraw" ] = {}
  218.     }
  219.    
  220.     // Fast access variables
  221.     G.FAV[1]  = "ValveBiped.Bip01_Head1" // HeadBoneString
  222.     G.FAV[2]  = RealTime() // GlobalWaitTime
  223.     G.FAV[3]  = "" // FontName
  224.     G.FAV[4]  = false // MenuOpen
  225.     G.FAV[5]  = nil // OldConsoleText ** UNUSED **
  226.     G.FAV[6]  = nil // Old ** UNUSED **
  227.     G.FAV[7]  = false // Once
  228.     G.FAV[8]  = nil // HideScreen ** UNUSED **
  229.     G.FAV[9]  = {} // HookStringPool
  230.     G.FAV[10] = 0 // AimWaitTime
  231.     G.FAV[11] = __R.CUserCmd.SetViewAngles // SetViewAngles
  232.     G.FAV[12] = false // ShouldResetTarget
  233.     G.FAV[13] = false // SettingsLoaded
  234.     G.FAV[14] = CreateMaterial( "Gun Dealer", 'UnlitGeneric', { [ "$basetexture" ] = "white", [ "$model" ] = 1, [ "$ignorez" ] = 1, [ "$nofog" ] = 1 } ) // ChamsMat
  235.     G.FAV[15] = false // ShouldCham
  236.    
  237.     G.AimbotWaste = {
  238.         [ "StopLoop" ] = false,
  239.         [ "Target" ] = 0,
  240.         [ "AimKeyDown" ] = false,
  241.         [ "Aimbotting" ] = false
  242.     }
  243.    
  244.     G.FAV.Keys = {} // I could have used GetKeyName but whatever
  245.    
  246.     // Keyboard Keys
  247.     G.FAV.Keys[1] = KEY_0
  248.     G.FAV.Keys[2] = KEY_1
  249.     G.FAV.Keys[3] = KEY_2
  250.     G.FAV.Keys[4] = KEY_3
  251.     G.FAV.Keys[5] = KEY_4
  252.     G.FAV.Keys[6] = KEY_5
  253.     G.FAV.Keys[7] = KEY_6
  254.     G.FAV.Keys[8] = KEY_7
  255.     G.FAV.Keys[9] = KEY_8
  256.     G.FAV.Keys[10] = KEY_9
  257.     G.FAV.Keys[11] = KEY_A
  258.     G.FAV.Keys[12] = KEY_APOSTROPHE
  259.     G.FAV.Keys[13] = KEY_APP
  260.     G.FAV.Keys[14] = KEY_B
  261.     G.FAV.Keys[15] = KEY_BACKQUOTE
  262.     G.FAV.Keys[16] = KEY_BACKSLASH
  263.     G.FAV.Keys[17] = KEY_BACKSPACE
  264.     G.FAV.Keys[18] = KEY_BREAK
  265.     G.FAV.Keys[19] = KEY_C
  266.     G.FAV.Keys[20] = KEY_CAPSLOCK
  267.     G.FAV.Keys[21] = KEY_CAPSLOCKTOGGLE
  268.     G.FAV.Keys[22] = KEY_COMMA
  269.     G.FAV.Keys[23] = KEY_COUNT
  270.     G.FAV.Keys[24] = KEY_D
  271.     G.FAV.Keys[25] = KEY_DELETE
  272.     G.FAV.Keys[26] = KEY_DOWN
  273.     G.FAV.Keys[27] = KEY_E
  274.     G.FAV.Keys[28] = KEY_END
  275.     G.FAV.Keys[29] = KEY_ENTER
  276.     G.FAV.Keys[30] = KEY_EQUAL
  277.     G.FAV.Keys[31] = KEY_ESCAPE
  278.     G.FAV.Keys[32] = KEY_F
  279.     G.FAV.Keys[33] = KEY_F1
  280.     G.FAV.Keys[34] = KEY_F10
  281.     G.FAV.Keys[35] = KEY_F11
  282.     G.FAV.Keys[36] = KEY_F12
  283.     G.FAV.Keys[37] = KEY_F2
  284.     G.FAV.Keys[38] = KEY_F3
  285.     G.FAV.Keys[39] = KEY_F4
  286.     G.FAV.Keys[40] = KEY_F5
  287.     G.FAV.Keys[41] = KEY_F6
  288.     G.FAV.Keys[42] = KEY_F7
  289.     G.FAV.Keys[43] = KEY_F8
  290.     G.FAV.Keys[44] = KEY_F9
  291.     G.FAV.Keys[45] = KEY_FIRST
  292.     G.FAV.Keys[46] = KEY_G
  293.     G.FAV.Keys[47] = KEY_H
  294.     G.FAV.Keys[48] = KEY_HOME
  295.     G.FAV.Keys[49] = KEY_I
  296.     G.FAV.Keys[50] = KEY_INSERT
  297.     G.FAV.Keys[51] = KEY_J
  298.     G.FAV.Keys[52] = KEY_K
  299.     G.FAV.Keys[53] = KEY_L
  300.     G.FAV.Keys[54] = KEY_LALT
  301.     G.FAV.Keys[55] = KEY_LAST
  302.     G.FAV.Keys[56] = KEY_LBRACKET
  303.     G.FAV.Keys[57] = KEY_LCONTROL
  304.     G.FAV.Keys[58] = KEY_LEFT
  305.     G.FAV.Keys[59] = KEY_LSHIFT
  306.     G.FAV.Keys[60] = KEY_LWIN
  307.     G.FAV.Keys[61] = KEY_M
  308.     G.FAV.Keys[62] = KEY_MINUS
  309.     G.FAV.Keys[63] = KEY_N
  310.     G.FAV.Keys[64] = KEY_NONE
  311.     G.FAV.Keys[65] = KEY_NUMLOCK
  312.     G.FAV.Keys[66] = KEY_NUMLOCKTOGGLE
  313.     G.FAV.Keys[67] = KEY_O
  314.     G.FAV.Keys[68] = KEY_P
  315.     G.FAV.Keys[69] = KEY_PAD_0
  316.     G.FAV.Keys[70] = KEY_PAD_1
  317.     G.FAV.Keys[71] = KEY_PAD_2
  318.     G.FAV.Keys[72] = KEY_PAD_3
  319.     G.FAV.Keys[73] = KEY_PAD_4
  320.     G.FAV.Keys[74] = KEY_PAD_5
  321.     G.FAV.Keys[75] = KEY_PAD_6
  322.     G.FAV.Keys[76] = KEY_PAD_7
  323.     G.FAV.Keys[77] = KEY_PAD_8
  324.     G.FAV.Keys[78] = KEY_PAD_9
  325.     G.FAV.Keys[79] = KEY_PAD_DECIMAL
  326.     G.FAV.Keys[80] = KEY_PAD_DIVIDE
  327.     G.FAV.Keys[81] = KEY_PAD_ENTER
  328.     G.FAV.Keys[82] = KEY_PAD_MINUS
  329.     G.FAV.Keys[83] = KEY_PAD_MULTIPLY
  330.     G.FAV.Keys[84] = KEY_PAD_PLUS
  331.     G.FAV.Keys[85] = KEY_PAGEDOWN
  332.     G.FAV.Keys[86] = KEY_PAGEUP
  333.     G.FAV.Keys[87] = KEY_PERIOD
  334.     G.FAV.Keys[88] = KEY_Q
  335.     G.FAV.Keys[89] = KEY_R
  336.     G.FAV.Keys[90] = KEY_RALT
  337.     G.FAV.Keys[91] = KEY_RBRACKET
  338.     G.FAV.Keys[92] = KEY_RCONTROL
  339.     G.FAV.Keys[93] = KEY_RIGHT
  340.     G.FAV.Keys[94] = KEY_RSHIFT
  341.     G.FAV.Keys[95] = KEY_RWIN
  342.     G.FAV.Keys[96] = KEY_S
  343.     G.FAV.Keys[97] = KEY_SCROLLLOCK
  344.     G.FAV.Keys[98] = KEY_SCROLLLOCKTOGGLE
  345.     G.FAV.Keys[99] = KEY_SEMICOLON
  346.     G.FAV.Keys[100] = KEY_SLASH
  347.     G.FAV.Keys[101] = KEY_SPACE
  348.     G.FAV.Keys[102] = KEY_T
  349.     G.FAV.Keys[103] = KEY_TAB
  350.     G.FAV.Keys[104] = KEY_U
  351.     G.FAV.Keys[105] = KEY_UP
  352.     G.FAV.Keys[106] = KEY_V
  353.     G.FAV.Keys[107] = KEY_W
  354.     G.FAV.Keys[108] = KEY_X
  355.     G.FAV.Keys[109] = KEY_XBUTTON_A
  356.     G.FAV.Keys[110] = KEY_XBUTTON_B
  357.     G.FAV.Keys[111] = KEY_XBUTTON_BACK
  358.     G.FAV.Keys[112] = KEY_XBUTTON_DOWN
  359.     G.FAV.Keys[113] = KEY_XBUTTON_LEFT
  360.     G.FAV.Keys[114] = KEY_XBUTTON_LEFT_SHOULDER
  361.     G.FAV.Keys[115] = KEY_XBUTTON_LTRIGGER
  362.     G.FAV.Keys[116] = KEY_XBUTTON_RIGHT
  363.     G.FAV.Keys[117] = KEY_XBUTTON_RIGHT_SHOULDER
  364.     G.FAV.Keys[118] = KEY_XBUTTON_RTRIGGER
  365.     G.FAV.Keys[119] = KEY_XBUTTON_START
  366.     G.FAV.Keys[120] = KEY_XBUTTON_STICK1
  367.     G.FAV.Keys[121] = KEY_XBUTTON_STICK2
  368.     G.FAV.Keys[122] = KEY_XBUTTON_UP
  369.     G.FAV.Keys[123] = KEY_XBUTTON_X
  370.     G.FAV.Keys[124] = KEY_XBUTTON_Y
  371.     G.FAV.Keys[125] = KEY_XSTICK1_DOWN
  372.     G.FAV.Keys[126] = KEY_XSTICK1_LEFT
  373.     G.FAV.Keys[127] = KEY_XSTICK1_RIGHT
  374.     G.FAV.Keys[128] = KEY_XSTICK1_UP
  375.     G.FAV.Keys[129] = KEY_XSTICK2_DOWN
  376.     G.FAV.Keys[130] = KEY_XSTICK2_LEFT
  377.     G.FAV.Keys[131] = KEY_XSTICK2_RIGHT
  378.     G.FAV.Keys[132] = KEY_XSTICK2_UP
  379.     G.FAV.Keys[133] = KEY_XSTICK2_DOWN
  380.     G.FAV.Keys[134] = KEY_XSTICK2_LEFT
  381.     G.FAV.Keys[135] = KEY_XSTICK2_RIGHT
  382.     G.FAV.Keys[136] = KEY_XSTICK2_UP
  383.     G.FAV.Keys[137] = KEY_Y
  384.     G.FAV.Keys[138] = KEY_Z
  385.    
  386.     // Mouse Buttons
  387.     G.FAV.Keys[139] = MOUSE_LEFT
  388.     G.FAV.Keys[140] = MOUSE_RIGHT
  389.     G.FAV.Keys[141] = MOUSE_MIDDLE
  390.     G.FAV.Keys[142] = MOUSE_4
  391.     G.FAV.Keys[143] = MOUSE_5
  392.     G.FAV.Keys[144] = MOUSE_WHEEL_UP
  393.     G.FAV.Keys[145] = MOUSE_WHEEL_DOWN
  394.     G.FAV.Keys[146] = MOUSE_COUNT
  395.     G.FAV.Keys[147] = MOUSE_FIRST
  396.     G.FAV.Keys[148] = MOUSE_LAST
  397.    
  398.     /*
  399.    
  400.     // Bind System Layout
  401.    
  402.     BindType = "Keyboard" or "Mouse"
  403.     Button = G.NumberToKey( 137 ) or KEY_END
  404.     WaitTime = 0.02
  405.     BeingHeld = false
  406.     OnPressed = function()
  407.         Do_Stuff
  408.     end
  409.     OnReleased = function()
  410.         Do_Stuff
  411.     end
  412.    
  413.     */
  414.    
  415.     function G.Library.CreateBinds()
  416.         local MouseTypes = {
  417.             [ 139 ] = true,
  418.             [ 140 ] = true,
  419.             [ 141 ] = true,
  420.             [ 142 ] = true,
  421.             [ 143 ] = true,
  422.             [ 144 ] = true,
  423.             [ 145 ] = true,
  424.             [ 146 ] = true,
  425.             [ 147 ] = true,
  426.             [ 148 ] = true
  427.         }
  428.        
  429.         G.BindSystem.Binds = {
  430.             [ "Aimbot" ] = {
  431.                 [ "BindType" ] = MouseTypes[ G.GetSetting( "aim_key" ) ] and "Mouse" or "Keyboard",
  432.                 [ "Button" ] = G.GetSetting( "aim_key" ) ~= 0 and G.NumberToKey( G.GetSetting( "aim_key" ) ) or KEY_XBUTTON_A,
  433.                 [ "WaitTime" ] = 0.00,
  434.                 [ "BeingHeld" ] = false,
  435.                
  436.                 [ "OnPressed" ] = function()
  437.                     G.AimbotWaste.AimKeyDown = true
  438.                 end,
  439.                
  440.                 [ "OnReleased" ] = function()
  441.                     G.AimbotWaste.AimKeyDown = false
  442.                 end
  443.             },
  444.             [ "Unload" ] = {
  445.                 [ "BindType" ] = "Keyboard",
  446.                 [ "Button" ] = KEY_END,
  447.                 [ "WaitTime" ] = 0.00,
  448.                 [ "BeingHeld" ] = false,
  449.                
  450.                 [ "OnPressed" ] = function()
  451.                     G.Unload()
  452.                 end,
  453.                
  454.                 [ "OnReleased" ] = function()
  455.                 end
  456.             },
  457.             [ "Menu" ] = {
  458.                 [ "BindType" ] = "Keyboard",
  459.                 [ "Button" ] = KEY_INSERT,
  460.                 [ "WaitTime" ] = 0.25,
  461.                 [ "BeingHeld" ] = false,
  462.                
  463.                 [ "OnPressed" ] = function()
  464.                     G.TogglePanelVisiblity()
  465.                 end,
  466.                
  467.                 [ "OnReleased" ] = function()
  468.                 end
  469.             }
  470.         }
  471.     end
  472.    
  473.     /*
  474.    
  475.     // Console Commands Layout
  476.    
  477.     Naame = "SetSetting"
  478.     Arguments = { 3, [ first, second, third ] }
  479.     HelpEx = Changes a setting
  480.     OnActivated = function()
  481.         Do_Stuff
  482.     end
  483.    
  484.     */
  485.    
  486.     function G.Console.CreateCommands()
  487.         G.Console.Commands = {
  488.             [ "setsetting" ] = {
  489.                 [ "Name" ] = "SetSetting",
  490.                 [ "Arguments" ] = { 2, "[ setting, value ]" },
  491.                 [ "HelpEx" ] = "Changes a setting",
  492.                 [ "OnActivated" ] = function( args )                   
  493.                     local command = args[1]
  494.                     local setting = args[2]
  495.                     local num     = args[3]
  496.                    
  497.                     G.SetSetting( setting, tonumber( num ) )
  498.                 end
  499.             },
  500.             [ "help" ] = {
  501.                 [ "Name" ] = "Help",
  502.                 [ "Arguments" ] = { 1, "[ command ]" },
  503.                 [ "HelpEx" ] = "Shows help for a command",
  504.                 [ "OnActivated" ] = function( args )               
  505.                     local command   = string.lower( args[2] )
  506.                     local help      = G.Console.Commands[ command ][ "HelpEx" ]
  507.                     local arguments = G.Console.Commands[ command ][ "Arguments" ][ 2 ]
  508.                     local name      = G.Console.Commands[ command ][ "Name" ]
  509.                    
  510.                     G.LogConsole( name .. ": " .. help .. " " .. arguments )
  511.                 end
  512.             },
  513.             [ "commands" ] = {
  514.                 [ "Name" ] = "Commands",
  515.                 [ "Arguments" ] = { 0, "" },
  516.                 [ "HelpEx" ] = "Lists all the commands",
  517.                 [ "OnActivated" ] = function( args )
  518.                     for k, v in loop, G.Console.Commands do
  519.                         MsgN( " " ) // Spacer
  520.                         G.LogConsole( "Name: " .. v[ "Name" ] )
  521.                         G.LogConsole( "Description: " .. v[ "HelpEx" ] )
  522.                         G.LogConsole( "Arguments: " .. v[ "Arguments" ][ 2 ] )
  523.                     end
  524.                 end
  525.             }
  526.         }
  527.     end
  528.    
  529.     /*
  530.    
  531.     // Settings Callbacks Layout
  532.    
  533.     OnCalled = function()
  534.         Do_Stuff
  535.     end
  536.    
  537.     */
  538.    
  539.     function G.Library.CreateSettingsCallbacks()
  540.         G.SettingsCallbacks = {
  541.             [ "aim_key" ] = {
  542.                 [ "OnCalled" ] = function( setting, num )
  543.                     G.LogConsole( "[ SettingsCallbacks ] [ OnCalled ] [ " .. setting .. " " .. num .. " ] Refreshing binds since aim_key was changed" )
  544.                
  545.                     G.Library.CreateBinds()
  546.                 end
  547.             },
  548.             [ "aim_priority" ] = {
  549.                 [ "OnCalled" ] = function( setting, num )
  550.                     G.LogConsole( "[ SettingsCallbacks ] [ OnCalled ] [ " .. setting .. " " .. num .. " ] Resetting target since aim_priority was changed" )
  551.                    
  552.                     G.FAV[12] = true
  553.                 end
  554.             },
  555.             [ "aim_lock" ] = {
  556.                 [ "OnCalled" ] = function( setting, num )
  557.                     G.LogConsole( "[ SettingsCallbacks ] [ OnCalled ] [ " .. setting .. " " .. num .. " ] Resetting target since aim_lock was changed" )
  558.                    
  559.                     G.FAV[12] = true
  560.                 end
  561.             }
  562.         }
  563.     end
  564.    
  565.     // Log stuff to the console
  566.     function G.LogConsole( txt )
  567.         MsgC( Color( 155, 155, 155, 255 ), "[GAYBO] " .. tostring( txt ) .. "\n" )
  568.     end
  569.    
  570.     // Log stuff to chat
  571.     function G.LogChat( txt, bool )
  572.         if ( bool ) then
  573.             chat.AddText( Color( 0, 0, 0, 0 ), " " ) // Spacer
  574.         else
  575.             chat.AddText( Color( 41, 128, 185 ), "[GAYBO] " .. txt )
  576.         end
  577.     end
  578.    
  579.     // Log stuff to a text file
  580.     function G.LogFile( txt, bool )
  581.         local file_name = ( CHANGE_ME1 .. ".txt" )
  582.        
  583.         if not ( file.Exists( file_name, "DATA" ) ) then
  584.             file.Write( file_name, "Log file created " .. os.date() .. "\n" )
  585.             file.Append( file_name, "[" .. os.date() .. "] " .. txt .. "\n" )
  586.         else
  587.             file.Append( file_name, "[" .. os.date() .. "] " .. txt .. "\n" )
  588.         end
  589.        
  590.         if not ( bool ) then
  591.             G.LogConsole( 'Logged text "' .. txt .. '" to: ' .. CHANGE_ME1 .. '.txt' )
  592.         end
  593.     end
  594.    
  595.     // Log settings to a text file
  596.     function G.LogSettings( settings, typ )
  597.         local file_name = typ == 1 and ( CHANGE_ME2 .. ".txt" ) or ( "cs_italy.txt" ) // cs_italy was for HitboxFix, which is now removed
  598.         local tab = util.TableToJSON( settings )
  599.    
  600.         file.Write( file_name, tab )
  601.     end
  602.    
  603.     // Random String
  604.     function G.RandomString( amt )
  605.         local str = ""
  606.             for i = 1, amt do
  607.                 str = str .. string.char( math.random( 97, 122 ) )
  608.             end
  609.         return str
  610.     end
  611.    
  612.     // Normalize a angle (???)
  613.     function G.Normalize( ang )
  614.         return ( ang + 180 ) % 360 - 180
  615.     end
  616.    
  617.     // Unload function
  618.     function G.Unload()
  619.         local MenuOpen = G.FAV[4]
  620.        
  621.         for k, v in loop, G.Hooks do
  622.             hook.Remove( v[ "type" ], v[ "name" ], v[ "function" ] ) // Necessary because of the names (function, type)
  623.         end
  624.        
  625.         G.LogChat( "Cheat unloaded" )
  626.        
  627.         if ( MenuOpen ) then
  628.             G.TogglePanelVisiblity()
  629.         end
  630.        
  631.         G = nil
  632.  
  633.         collectgarbage()
  634.     end
  635.    
  636.     // Strings to a table
  637.     function G.StringToTable( str )
  638.         local tab = {}
  639.        
  640.         for v in gmatch( str, "([^ ]+)" ) do
  641.             insert( tab, v )
  642.         end
  643.        
  644.         return tab
  645.     end
  646.    
  647.     // Font
  648.     function G.Library.DrawMisc()
  649.         local str = G.RandomString( math.Rand( 1, 15 ) )
  650.        
  651.         local ftab = {
  652.             [ "font" ]      = "Arial",
  653.             [ "size" ]      = 15,
  654.             [ "weight" ]    = 500,
  655.             [ "antialias" ] = false,
  656.             [ "shadow" ]    = true,
  657.             [ "outline" ]   = false,
  658.         }
  659.        
  660.         G.FAV[3] = str
  661.    
  662.         surface.CreateFont( str, ftab )
  663.     end
  664.    
  665.     // Setting Prefixes
  666.     G.SettingsPrefixs = {
  667.         [ "aim" ] = "Aimbot",
  668.         [ "esp" ] = "ESP",
  669.         [ "mis" ] = "Miscellaneous" // Misc
  670.     }
  671.    
  672.     // Settings system     
  673.     G.Settings = {
  674.         [ "aim_enabled" ]           = { [1] = "Enable the aimbot",                                             [2] = 0 },
  675.         [ "aim_team" ]              = { [1] = "Aimbot wont target teammates",                                  [2] = 0 },
  676.         [ "aim_steam" ]             = { [1] = "Aimbot wont target steam friends",                              [2] = 0 },
  677.         [ "aim_fov" ]               = { [1] = "The field of view the aimbot will only target in",              [2] = 0 },
  678.         [ "aim_key" ]               = { [1] = "The key that enables/disables the aimbot",                      [2] = 0 },
  679.         [ "aim_nospread" ]          = { [1] = "Aimbot will compensate for weapon spread",                      [2] = 0 }, //
  680.         [ "aim_prediction" ]        = { [1] = "Aimbot will predict one tick into the future",                  [2] = 0 },
  681.         [ "aim_norecoil" ]          = { [1] = "Aimbot will compensate for weapon recoil",                      [2] = 0 },
  682.         [ "aim_smooth" ]            = { [1] = "Aimbot will aim smooth instead of snap",                        [2] = 0 },
  683.         [ "aim_smooth_value" ]      = { [1] = "Amount aimbot will be smoothed by",                             [2] = 0 },
  684.         [ "aim_humanize" ]          = { [1] = "Aimbot will look a lot more human",                             [2] = 0 }, //
  685.         [ "aim_autofire" ]          = { [1] = "Aimbot will shoot once it's locked onto a target",              [2] = 0 },
  686.         [ "aim_rapidfire" ]         = { [1] = "Aimbot will shoot pistols and other guns rapidly",              [2] = 0 },
  687.         [ "aim_priority" ]          = { [1] = "Aimbot target selection will be prioritized (Distance, Angle)", [2] = 0 },
  688.         [ "aim_lock" ]              = { [1] = "Aimbot will lock until the target is invalid or aimkey lifted", [2] = 0 },
  689.         [ "esp_enabled" ]           = { [1] = "Enable the ESP",                                                [2] = 0 },
  690.         [ "esp_name" ]              = { [1] = "Players names will be drawn on them",                           [2] = 0 },
  691.         [ "esp_rank" ]              = { [1] = "Players rank will be draw on them",                             [2] = 0 },
  692.         [ "esp_health" ]            = { [1] = "Players health will be drawn on them",                          [2] = 0 },
  693.         [ "esp_weapon" ]            = { [1] = "Players weapon will be drawn on them",                          [2] = 0 },
  694.         [ "esp_box" ]               = { [1] = "A box will be drawn around players",                            [2] = 0 },
  695.         [ "esp_distance" ]          = { [1] = "Maximum distance the ESP will be drawn at",                     [2] = 0 }, //
  696.         [ "esp_traitors" ]          = { [1] = "Show traitors on the ESP (TTT)",                                [2] = 0 }, //
  697.         [ "esp_weapons" ]           = { [1] = "Show weapons on the ESP (TTT, DarkRP)",                         [2] = 0 }, //
  698.         [ "esp_murderer" ]          = { [1] = "Show the murderer on the ESP (Murder)",                         [2] = 0 }, //
  699.         [ "esp_loot" ]              = { [1] = "Show loot on the ESP (Murder)",                                 [2] = 0 }, //
  700.         [ "esp_shipments" ]         = { [1] = "Show shipments on the ESP (DarkRP)",                            [2] = 0 }, //
  701.         [ "esp_chams" ]             = { [1] = "Players will be masked with a material visible through walls",  [2] = 0 },
  702.         [ "misc_bhop" ]             = { [1] = "If space is being pressed you will jump auto",                  [2] = 0 },
  703.         [ "misc_bhop_autostrafer" ] = { [1] = "You will strafe in the direction you are facing",               [2] = 0 },
  704.         [ "misc_spectators" ]       = { [1] = "Players spectating you will be shown",                          [2] = 0 }, //
  705.         [ "misc_crosshair" ]        = { [1] = "A crosshair will be drawn on your screen",                      [2] = 0 }
  706.     }
  707.    
  708.     function G.GetSetting( setting )
  709.         return( G.Settings[ setting ][ 2 ] )
  710.     end
  711.    
  712.     function G.SetSetting( setting, num )  
  713.         G.Settings[ setting ][ 2 ] = num
  714.         G.LogSettings( G.Settings, 1 )
  715.        
  716.         if ( G.SettingsCallbacks[ setting ] ) then
  717.             G.SettingsCallbacks[ setting ][ "OnCalled" ]( setting, num )
  718.         end
  719.        
  720.         G.LogConsole( "[ SetSetting ] Set setting " .. setting .. " to " .. num )
  721.     end
  722.    
  723.     function G.Library.SettingsInit()
  724.         local file_name = ( CHANGE_ME2 .. ".txt" )
  725.         local file_json = {}
  726.         local file_settings = {}
  727.         local count = 0
  728.        
  729.         if ( file.Exists( file_name, "DATA" ) and file.Read( file_name, "DATA" ) ~= "" ) then
  730.             file_json = file.Read( file_name )
  731.             file_settings = util.JSONToTable( file_json )
  732.            
  733.             if ( table.Count( file_settings ) ~= table.Count( G.Settings ) ) then
  734.                 file.Write( CHANGE_ME2 .. "_custom.txt", file.Read( file_name ) )
  735.                
  736.                 for k, v in loop, G.Settings do
  737.                     if not ( file_settings[ k ] ) then
  738.                         file_settings[ k ] = v
  739.                        
  740.                         count = count + 1
  741.                     end
  742.                 end
  743.                
  744.                 if ( count == 1 ) then // This wasn't unnecessary okay
  745.                     G.LogConsole( "1 feature has been added to the cheat" )
  746.                 else
  747.                     G.LogConsole( count .. " features have been added to the cheat" )
  748.                 end
  749.             end
  750.            
  751.             for k, v in loop, G.Settings do
  752.                 v[ 2 ] = file_settings[ k ][ 2 ]
  753.             end
  754.         else
  755.             G.LogSettings( G.Settings, 1 )
  756.         end
  757.        
  758.         MsgN( " " ) // Spacer
  759.                
  760.         for k, v in loop, G.Settings do
  761.             G.LogConsole( "[ SettingsInit ] " .. "[ " .. k .. " " .. v[ 2 ] .. " ] Setting Loaded!" )
  762.         end
  763.        
  764.         MsgN( " " ) // Spacer
  765.        
  766.         G.FAV[13] = true
  767.     end
  768.        
  769.     // Hook System
  770.    
  771.     function G.HookFunc( typ, name, func )
  772.         local str = ( G.RandomString( math.Rand( 1, 25 ) ) )
  773.        
  774.         insert( G.FAV[9], str )
  775.         hook.Add( typ, str, func )
  776.        
  777.         G.Hooks[ str ] = {
  778.             [ "type" ]     = typ,
  779.             [ "name" ]     = str,
  780.             [ "function" ] = func
  781.         }
  782.        
  783.         G.LogConsole( "[ HookFunc ] [ " .. name .. " ] has been hooked with [ " .. typ .. " ]" )
  784.     end
  785.    
  786.     function G.HUDPaint()      
  787.         for k, func in loop, G.HookFuncs.HUDPaint do           
  788.             func()
  789.         end
  790.     end
  791.        
  792.     function G.CreateMove( cmd )       
  793.         for k, func in loop, G.HookFuncs.CreateMove do     
  794.             func( cmd )
  795.         end
  796.     end
  797.    
  798.     function G.Think()     
  799.         for k, func in loop, G.HookFuncs.Think do      
  800.             func()
  801.         end
  802.     end
  803.    
  804.     function G.PrePlayerDraw( ply )
  805.         for k, func in loop, G.HookFuncs.PrePlayerDraw do
  806.             func( ply )
  807.         end
  808.     end
  809.    
  810.     function G.Library.HookGFuncs()
  811.         G.HookFunc( "HUDPaint", "HUDPaint", G.HUDPaint )
  812.         G.HookFunc( "CreateMove", "CreateMove", G.CreateMove )
  813.         G.HookFunc( "Think", "Think", G.Think )
  814.         G.HookFunc( "PrePlayerDraw", "PrePlayerDraw", G.PrePlayerDraw )
  815.     end
  816.    
  817.     local __trace = {}
  818.    
  819.     function G.IsVisible( pos, v )
  820.         local ply = LocalPlayer()
  821.         local gsp = ply:GetShootPos()
  822.        
  823.         local _trace = {
  824.             [ "start" ] = gsp,
  825.             [ "endpos" ] = pos,
  826.             [ "filter" ] = ply,
  827.             [ "mask" ] = MASK_SHOT
  828.         }
  829.        
  830.         local trace = TraceLine( _trace, __trace )
  831.        
  832.         if ( trace.Fraction == 1 ) or ( trace.Entity == v ) then
  833.             return true
  834.         end
  835.        
  836.        return false
  837.     end
  838.    
  839.    function G.InFov( ang, typ )
  840.         local ply = LocalPlayer()
  841.         local fov = G.GetSetting( "aim_fov" )
  842.  
  843.         local diff = abs( AngleDifference( ang.p, ply:EyeAngles().p ) ) + abs( AngleDifference( ang.y, ply:EyeAngles().y ) )
  844.        
  845.         if ( fov == 0 or fov == 360 ) then
  846.             if ( typ == 1 ) then
  847.                 return true
  848.             else
  849.                 return diff
  850.             end
  851.         end
  852.                
  853.         if ( diff >= fov ) then
  854.             if ( typ == 1 ) then
  855.                 return false
  856.             else
  857.                 return 0
  858.             end
  859.         end
  860.        
  861.         if ( typ == 1 ) then
  862.             return true
  863.         else
  864.             return diff
  865.         end
  866.    end
  867.        
  868.     function G.IsValidPlayer( v, typ )
  869.         local ply = LocalPlayer()
  870.         local pos = Vector()
  871.         local ang = Angle()
  872.        
  873.         if ( type( v ) == "number" ) then
  874.             return
  875.         end
  876.        
  877.         if ( typ == 1 ) then // ESP
  878.            
  879.             if ( v == ply ) or ( not ( v:Alive() ) or ( v:IsDormant() ) ) then
  880.                 return false
  881.             end
  882.            
  883.             return true
  884.            
  885.         elseif ( typ == 2 ) then // Aimbot
  886.            
  887.             if ( v == ply ) or ( not ( v:Alive() ) or ( v:GetColor().a < 255 ) or ( v:IsDormant() ) ) then
  888.                 return false
  889.             end
  890.            
  891.             pos = G.GetAimPosition( v )
  892.            
  893.             if not ( G.IsVisible( pos, v ) ) then
  894.                 return false
  895.             end
  896.            
  897.             if ( v:Team() == ply:Team() ) and ( G.GetSetting( "aim_team" ) ~= 1 ) then
  898.                 return false
  899.             end
  900.            
  901.             if ( v:GetFriendStatus() == "friend" ) and ( G.GetSetting( "aim_steam" ) == 1 ) then
  902.                 return false
  903.             end
  904.            
  905.             ang = ( pos - ply:GetShootPos() ):Angle()
  906.            
  907.             if not ( G.InFov( ang, 1 ) ) then
  908.                 return false
  909.             end
  910.            
  911.             return ang
  912.         end
  913.        
  914.     end
  915.            
  916.     // ESP
  917.    
  918.     function G.GetNiceWeaponName( v )
  919.         local weapon = v:GetActiveWeapon() 
  920.  
  921.         if ( weapon == NULL ) then
  922.             return ""
  923.         end
  924.        
  925.         local class = weapon:GetClass()
  926.         local nice_class = gsub( class, "weapon_", "" )
  927.            
  928.         return nice_class
  929.     end
  930.    
  931.     function G.BoxESP( v, color ) // TODO: Upgrade to OBBMaxs and OBBMins      
  932.         local col = Color( color.r, color.g, color.b, color.a - 100 )
  933.         local top = ( G.GetAimPosition( v ) + Vector( 0, 0, 5 ) )
  934.         local bot = ( top - Vector( 0, 0, 65 ) )
  935.         local out1, out2 = top:ToScreen(), bot:ToScreen()
  936.        
  937.         if not ( out1.visible ) then
  938.             return
  939.         end
  940.        
  941.         local h = ( out2.y - out1.y )
  942.         local w = ( h / 4 )
  943.        
  944.         SetDrawColor( col ) // Player's health
  945.        
  946.         DrawOutlinedRect( out1.x - w, out1.y, w * 2, h ) // First box
  947.        
  948.         SetDrawColor( 0, 0, 0, 255 ) // Make the outline dark          
  949.        
  950.         DrawOutlinedRect( out1.x - w - 1, out1.y - 1, w * 2 + 2, h + 2 ) // Outline 1
  951.         DrawOutlinedRect( out1.x - w + 1, out1.y + 1, w * 2 - 2, h - 2 ) // Outline 2
  952.     end
  953.    
  954.     function G.TextESP( v, col )       
  955.         local _top = ( ( v:GetPos() + v:OBBCenter() ) )
  956.         local _bot = ( _top - Vector( 0, 0, 65 ) )
  957.        
  958.         local top, bot = _top:ToScreen(), _bot:ToScreen()
  959.        
  960.         if not ( top.visible ) then
  961.             return
  962.         end
  963.        
  964.         local FontName = G.FAV[3]
  965.        
  966.         local pone_enabled = true
  967.        
  968.         local pone = ""
  969.         local ptwo = ""
  970.        
  971.         local health = ""
  972.         local health_enabled = false
  973.         local rank   = ""
  974.         local rank_enabled   = false
  975.         local name   = ""
  976.         local name_enabled   = false
  977.         local weapon = ""
  978.         local weapon_enabled = false
  979.        
  980.         if ( G.GetSetting( "esp_name" ) == 1 ) then
  981.             name = v:Nick()
  982.             name_enabled = true
  983.         else
  984.             name = ""
  985.             name_enabled = false
  986.         end
  987.        
  988.         if ( G.GetSetting( "esp_rank" ) == 1 ) then
  989.             rank = v:GetUserGroup()
  990.             rank_enabled = true
  991.         else
  992.             rank = ""
  993.             rank_enabled = false
  994.         end
  995.        
  996.         if ( G.GetSetting( "esp_health" ) == 1 ) then
  997.             health = v:Health()
  998.             health_enabled = true
  999.         else
  1000.             health = ""
  1001.             health_enabled = false
  1002.         end
  1003.        
  1004.         if ( G.GetSetting( "esp_weapon" ) == 1 ) and ( v:GetActiveWeapon() ~= NULL ) then
  1005.             weapon = G.GetNiceWeaponName( v )
  1006.             weapon_enabled = true
  1007.         else
  1008.             weapon = ""
  1009.             weapon_enabled = false
  1010.         end
  1011.        
  1012.         if ( name_enabled ) and ( rank_enabled ) then
  1013.             pone = ( name .. " | " .. rank )
  1014.         elseif ( name_enabled ) and not ( rank_enabled ) then
  1015.             pone = ( name )
  1016.         elseif not ( name_enabled ) and ( rank_enabled ) then
  1017.             pone = ( rank )
  1018.         elseif not ( name_enabled ) and not ( rank_enabled ) then
  1019.             pone = ""
  1020.         end
  1021.        
  1022.         if ( health_enabled ) and ( weapon_enabled ) then
  1023.             ptwo = ( health .. " | " .. weapon )
  1024.         elseif ( health_enabled ) and not ( weapon_enabled ) then
  1025.             ptwo = ( health )
  1026.         elseif not ( health_enabled ) and ( weapon_enabled ) then
  1027.             ptwo = ( weapon )
  1028.         elseif not ( health_enabled ) and not ( weapon_enabled ) then
  1029.             ptwo = ""
  1030.         end
  1031.            
  1032.         SetFont( FontName )
  1033.         SetTextColor( col )
  1034.  
  1035.         SetTextPos( top.x, top.y )
  1036.         DrawText( pone )
  1037.        
  1038.         SetTextPos( top.x, top.y + ( ( ( name_enabled ) or ( rank_enabled ) ) and 15 or 0 ) )
  1039.         DrawText( ptwo )
  1040.     end
  1041.    
  1042.     function G.FixModulation( col )
  1043.         local newcol = { [ "r" ] = col.r / 255, [ "g" ] = col.g / 255, [ "b" ] = col.b / 255 }
  1044.        
  1045.         return newcol
  1046.     end
  1047.    
  1048.     function G.HookFuncs.PrePlayerDraw.Chams( ply )
  1049.         local health = 0
  1050.         local smooth = 0
  1051.         local col_hp = {}
  1052.         local fixcol = {}
  1053.        
  1054.         local ShouldCam = G.FAV[15]
  1055.         local ChamsMat = G.FAV[14]
  1056.        
  1057.         local ChamsEnabled = G.GetSetting( "esp_chams" )
  1058.        
  1059.         if ( ShouldCam ) or ( ChamsEnabled ~= 1 ) then
  1060.             return
  1061.         end
  1062.        
  1063.         health = math.Clamp( ply:Health(), 0, ply:GetMaxHealth() )
  1064.         smooth = math.Approach( smooth, health, 50 * RealTime() )
  1065.         col_hp = HSVToColor( smooth / 100 * 120, 1, 1 )
  1066.         fixcol = G.FixModulation( col_hp )
  1067.        
  1068.        MaterialOverride( ChamsMat )
  1069.        SetColorModulation( fixcol.r, fixcol.g, fixcol.b )
  1070.        
  1071.        G.FAV[15] = true
  1072.        
  1073.        ply:DrawModel()
  1074.        
  1075.        SetColorModulation( 1, 1, 1 )
  1076.        MaterialOverride()
  1077.        
  1078.        ply:DrawModel()
  1079.        
  1080.        G.FAV[15] = false
  1081.     end
  1082.    
  1083.     function G.Crosshair( col )
  1084.         local x = ScrW() / 2
  1085.         local y = ScrH() / 2
  1086.         local i = 0
  1087.        
  1088.         SetDrawColor( col )
  1089.        
  1090.         for i = 0, 1 do
  1091.             surface.DrawLine( x + 10 + i, y, x, y )
  1092.             surface.DrawLine( x - 10 - i, y, x, y )
  1093.             surface.DrawLine( x, y + 10 + i, x, y )
  1094.             surface.DrawLine( x, y - 10 - i, x, y )
  1095.         end
  1096.     end
  1097.    
  1098.     function G.HookFuncs.HUDPaint.ESPMain()
  1099.         local ply = LocalPlayer()
  1100.         local col_hp = {}
  1101.         local col_team = {}
  1102.         local health = 0
  1103.         local smooth = 0
  1104.         local valid = false
  1105.        
  1106.         health = math.Clamp( ply:Health(), 0, ply:GetMaxHealth() )
  1107.         smooth = math.Approach( smooth, health, 50 * RealTime() )
  1108.         col_hp = HSVToColor( smooth / 100 * 120, 1, 1 )
  1109.        
  1110.         if ( G.GetSetting( "misc_crosshair" ) == 1 ) then
  1111.             G.Crosshair( col_hp )
  1112.         end
  1113.        
  1114.         if ( G.GetSetting( "esp_enabled" ) == 1 ) then
  1115.             for k, v in loop, GetAll() do      
  1116.                 valid = ( G.IsValidPlayer( v, 1 ) )
  1117.                
  1118.                 if not ( valid ) then
  1119.                     continue
  1120.                 end
  1121.                
  1122.                 col_team = team.GetColor( v:Team() )
  1123.                 health = math.Clamp( v:Health(), 0, v:GetMaxHealth() )
  1124.                 col_hp = HSVToColor( health / 100 * 120, 1, 1 )
  1125.                
  1126.                 if ( G.GetSetting( "esp_box" ) == 1 ) then
  1127.                     G.BoxESP( v, col_hp )
  1128.                 end
  1129.                
  1130.                 G.TextESP( v, col_team )
  1131.             end
  1132.         end
  1133.     end
  1134.    
  1135.     // Bunny Hop
  1136.    
  1137.     function G.HookFuncs.CreateMove.BunnyHop( cmd )
  1138.        local ply = LocalPlayer()
  1139.         local buttons = 0
  1140.        
  1141.         if ( G.GetSetting( "misc_bhop" ) == 1 ) then
  1142.             if ( cmd:KeyDown( IN_JUMP ) ) then
  1143.                 if ( G.GetSetting( "misc_bhop_autostrafer" ) == 1 ) then
  1144.                     if ( cmd:GetMouseX() < 0 ) then
  1145.                         cmd:SetSideMove( -10000000 )
  1146.                     elseif ( cmd:GetMouseX() > 0 ) then
  1147.                         cmd:SetSideMove( 10000000 )
  1148.                     end
  1149.                 end
  1150.                if ( ply:IsOnGround() ) then
  1151.                    buttons = cmd:GetButtons()
  1152.                    
  1153.                     cmd:SetButtons( buttons, IN_JUMP )
  1154.                else
  1155.                     buttons = cmd:GetButtons() - IN_JUMP
  1156.                
  1157.                    cmd:SetButtons( buttons )
  1158.                end
  1159.             end
  1160.         end
  1161.        
  1162.     end
  1163.    
  1164.     // Bind System
  1165.    
  1166.     function G.IsKeyDown( button, typ )
  1167.         if ( typ == "Keyboard" ) then
  1168.             if ( input.IsKeyDown( button ) ) then
  1169.                 return true
  1170.             end
  1171.         elseif ( typ == "Mouse" ) then
  1172.             if ( input.IsMouseDown( button ) ) then
  1173.                 return true
  1174.             end
  1175.         end
  1176.  
  1177.         return false
  1178.     end
  1179.    
  1180.     function G.HookFuncs.Think.BindSystem()    
  1181.         local GlobalWaitTime = G.FAV[2]
  1182.         local binds = G.BindSystem.Binds
  1183.        
  1184.         local Button = 0
  1185.         local WaitTime = 0
  1186.         local BindType = ""
  1187.         local BeingHeld = true
  1188.        
  1189.         for k, v in loop, binds do     
  1190.             Button = v[ "Button" ]
  1191.             WaitTime = v[ "WaitTime" ]
  1192.             BindType = v[ "BindType" ]
  1193.             BeingHeld = v[ "BeingHeld" ]
  1194.            
  1195.             local Stop = false
  1196.            
  1197.             if ( G.IsKeyDown( Button, BindType ) ) then            
  1198.                 Stop = false
  1199.                
  1200.                 if not ( WaitTime == 0 ) then
  1201.                     if ( RealTime() >= GlobalWaitTime ) then
  1202.                         G.FAV[2] = RealTime() + WaitTime
  1203.                        
  1204.                         Stop = false // :|
  1205.                     else
  1206.                         Stop = true
  1207.                     end
  1208.                 end
  1209.                
  1210.                 if ( Stop ) then
  1211.                     return
  1212.                 end
  1213.                
  1214.                 v[ "BeingHeld" ] = true
  1215.                 v[ "OnPressed" ]()
  1216.                
  1217.             elseif ( v[ "BeingHeld" ] ) then
  1218.                 if not ( G.IsKeyDown( Button, BindType ) ) then
  1219.                     v[ "BeingHeld" ] = false
  1220.                     v[ "OnReleased" ]()
  1221.                 end
  1222.             end
  1223.         end
  1224.     end
  1225.    
  1226.     function G.NumberToKey( number )
  1227.         local tab = G.FAV.Keys
  1228.        
  1229.         return tab[ number ]
  1230.     end
  1231.    
  1232.     // Aimbot
  1233.    
  1234.     function G.GetGeneralAimSpot( v )
  1235.         local forward = Vector()
  1236.         local eyes = Vector()
  1237.         local head = Vector()
  1238.         local center = Vector()
  1239.        
  1240.         if ( v:LookupAttachment( "forward" ) ~= 0 ) then
  1241.            forward = v:GetAttachment( v:LookupAttachment( "forward" ) )
  1242.          
  1243.             if ( forward ) and ( forward.Pos ) then
  1244.                 return forward.Pos
  1245.             end
  1246.        end
  1247.        if ( v:LookupAttachment( "eyes" ) ~= 0 ) then
  1248.            eyes = v:GetAttachment( v:LookupAttachment( "eyes" ) )
  1249.            
  1250.             if ( eyes ) and ( eyes.Pos ) then
  1251.                 return eyes.Pos
  1252.             end
  1253.        end
  1254.        if v:LookupBone( G.FAV[1] ) then
  1255.            head = v:GetBonePosition( v:LookupBone( G.FAV[1] ) )
  1256.            
  1257.             if ( head ) then
  1258.                 return head
  1259.             end
  1260.         end
  1261.         if ( v:OBBCenter() and v:GetPos() ) then
  1262.             center = ( v:GetPos() + v:OBBCenter() )
  1263.            
  1264.             if ( center ) then
  1265.                 return center
  1266.             end
  1267.         end
  1268.    end
  1269.  
  1270.     function G.HitboxPos( v ) // Get your own :)
  1271.    
  1272.     end
  1273.    
  1274.     function G.GetAimPosition( v )     
  1275.         local pos = G.GetGeneralAimSpot( v )
  1276.    
  1277.         return pos
  1278.     end
  1279.    
  1280.     function G.GetAimbotTarget()
  1281.         if ( G.AimbotWaste.Target == 0 ) then
  1282.             return 0
  1283.         end
  1284.        
  1285.         return IsValid( G.AimbotWaste.Target ) and G.AimbotWaste.Target or 0
  1286.     end
  1287.    
  1288.     function G.HookFuncs.CreateMove.GetAimbotTargets()     
  1289.         local ply = LocalPlayer()
  1290.        
  1291.         local range = 65535
  1292.         local distance = 0
  1293.         local setting = 1
  1294.        
  1295.         local valid = true
  1296.         local svalid = true
  1297.        
  1298.         local ang = Angle()
  1299.         local target = 0
  1300.  
  1301.         for k, v in loop, GetAll() do
  1302.             ang = ( G.IsValidPlayer( v, 2 ) )
  1303.            
  1304.             if not ( ang ) then
  1305.                 continue
  1306.             end
  1307.            
  1308.             if ( G.GetSetting( "aim_lock" ) == 1 ) then
  1309.                 target = G.AimbotWaste.Target or 0
  1310.                 svalid = G.IsValidPlayer( target, 2 )
  1311.                
  1312.                 if ( target ~= 0 ) and ( svalid ) and ( G.AimbotWaste.AimKeyDown ) then
  1313.                     return
  1314.                 end
  1315.             end
  1316.            
  1317.             if ( G.FAV[12] ) and ( target ) then // Unnecessary, don't care
  1318.                 target = 0
  1319.                 distance = 0
  1320.                 range = 0
  1321.                
  1322.                 G.FAV[12] = false
  1323.                
  1324.                 return
  1325.             end
  1326.            
  1327.             setting = G.GetSetting( "aim_priority" )
  1328.            
  1329.             // 0 = none
  1330.             // 1 = distance
  1331.             // 2 = angle
  1332.            
  1333.             if ( setting == 1 ) then
  1334.                 distance = ply:GetPos():Distance( v:GetPos() )
  1335.             elseif ( setting ~= 0 ) then
  1336.                 distance = G.InFov( ang, 2 )
  1337.             elseif ( setting == 0 ) then
  1338.                 target = v
  1339.                 range = distance
  1340.                
  1341.                 G.AimbotWaste.Target = target
  1342.                
  1343.                 return
  1344.             end
  1345.            
  1346.             if ( distance == range ) then // Jitter fix
  1347.                 return
  1348.             end
  1349.            
  1350.             if ( distance <= range ) then
  1351.                 target = v
  1352.                 range = distance
  1353.             end
  1354.         end
  1355.        
  1356.         G.AimbotWaste.Target = target
  1357.     end
  1358.    
  1359.     function G.SmoothAngle( cmd, ang, v )
  1360.        local ply = LocalPlayer()
  1361.         local smoothang = ang
  1362.        
  1363.         local speed = 0
  1364.         local enabl = G.GetSetting( "aim_smooth" )
  1365.        
  1366.         if ( enabl == 1 ) then     
  1367.             speed = RealFrameTime() / ( ( G.GetSetting( "aim_smooth_value" ) ) / 100.141592 )
  1368.             smoothang = LerpAngle( speed, ply:EyeAngles(), ang )
  1369.         end
  1370.        
  1371.        return smoothang
  1372.    end
  1373.    
  1374.     function G.HookFuncs.CreateMove.Aimbot( cmd )      
  1375.         local ply = LocalPlayer()
  1376.        
  1377.         local ang = Angle()
  1378.         local vel = Vector()
  1379.        
  1380.         local v = G.GetAimbotTarget()
  1381.         local once = G.FAV[7]
  1382.         local SetViewAngles = G.FAV[11]
  1383.        
  1384.         local buttons = 0
  1385.        
  1386.         if not ( once ) then
  1387.             if ( G.GetSetting( "aim_norecoil" ) == 1 ) then // No Recoil
  1388.                 old_plymeta.SetEyeAngles = function() end
  1389.             else
  1390.                 //old_plymeta.SetEyeAngles = G.Detours.OldFuncs.SetEyeAngles
  1391.             end
  1392.            
  1393.             G.FAV[7] = true
  1394.            
  1395.             return // I don't know why LocalPlayer gets targeted the first frame
  1396.         end
  1397.        
  1398.         if ( v == 0 or G.GetSetting( "aim_enabled" ) ~= 1 or G.GetSetting( "aim_key" ) ~= 0 and not G.AimbotWaste.AimKeyDown ) then
  1399.             G.AimbotWaste.Aimbotting = false
  1400.            
  1401.             return
  1402.         end
  1403.        
  1404.         if ( G.GetSetting( "aim_norecoil" ) == 1 ) then // No Recoil
  1405.             old_plymeta.SetEyeAngles = function() end
  1406.         else
  1407.             //old_plymeta.SetEyeAngles = G.Detours.OldFuncs.SetEyeAngles
  1408.         end
  1409.        
  1410.         local aim_pos = G.GetAimPosition( v )
  1411.        
  1412.         if ( G.IsVisible( aim_pos, v ) ) then
  1413.             G.AimbotWaste.Aimbotting = true
  1414.            
  1415.             if ( G.GetSetting( "aim_prediction" ) == 1 ) then // Nope
  1416.            
  1417.             end
  1418.            
  1419.             ang = ( aim_pos - ply:GetShootPos() ):Angle()
  1420.             ang = G.SmoothAngle( cmd, ang, v )
  1421.             ang = Angle( G.Normalize( ang.p ), G.Normalize( ang.y ), 0 )       
  1422.            
  1423.             SetViewAngles( cmd, ang )
  1424.            
  1425.             if ( G.GetSetting( "aim_autofire" ) == 1 ) and ( G.GetSetting( "aim_rapidfire" ) ~= 1 ) then
  1426.                 buttons = bit.bor( cmd:GetButtons(), IN_ATTACK )
  1427.                
  1428.                 cmd:SetButtons( buttons )
  1429.             elseif ( G.GetSetting( "aim_rapidfire" ) == 1 ) and ( RealTime() >= G.FAV[10] ) then
  1430.                 buttons = bit.bor( cmd:GetButtons(), IN_ATTACK )
  1431.                 G.FAV[10] = RealTime() + 0.02
  1432.                
  1433.                 cmd:SetButtons( buttons )
  1434.             end
  1435.         end
  1436.     end
  1437.    
  1438.     // Console Backend
  1439.    
  1440.     function G.Console.Input( str )
  1441.         local tab = G.StringToTable( str )
  1442.         local lower = string.lower( tab[ 1 ] )
  1443.        
  1444.         local _commands = G.Console.Commands       
  1445.         local cmd = _commands[ lower ]
  1446.        
  1447.         if not ( cmd ) then
  1448.             G.LogConsole( "The command specified does not exist, perhaps you mistyped it?" )
  1449.            
  1450.             return
  1451.         end
  1452.        
  1453.         if ( cmd[ "Arguments" ][ 1 ] ~= 0 and #tab - 1 > cmd[ "Arguments" ][ 1 ] or #tab - 1 == 0 and cmd[ "Arguments" ][ 1 ] == 1 ) then // wat
  1454.             G.LogConsole( "The command " .. cmd[ "Name" ] .. " only takes " .. cmd[ "Arguments" ][ 1 ] .. " argument(s) " .. cmd[ "Arguments" ][ 2 ] )
  1455.            
  1456.             return
  1457.         end
  1458.        
  1459.         cmd[ "OnActivated" ]( tab )
  1460.     end
  1461.  
  1462.     function G.Library.ConsoleFuncs()
  1463.         G.Console.CreateCommands()
  1464.     end
  1465.        
  1466.     // GUI
  1467.    
  1468.     function G.Theme.Panel:Init()
  1469.    
  1470.     end
  1471.  
  1472.     function G.Theme.Panel:Paint()
  1473.         self.btnMaxim:SetVisible( false )
  1474.         self.btnMinim:SetVisible( false )
  1475.         self.btnClose:SetVisible( false )
  1476.        
  1477.         if not ( G ) then  
  1478.             return
  1479.         end
  1480.        
  1481.         RoundedBox( 0, 0, 0, self:GetWide(), self:GetTall(), Color( 21, 108, 165, 200 ) )
  1482.        
  1483.         SetDrawColor( Color( 0, 0, 0, 255 ) );
  1484.         DrawOutlinedRect( 0, 0, self:GetWide(), self:GetTall())
  1485.        
  1486.         RoundedBox( 0, 1, 1, self:GetWide() - 2, 24, Color( 41, 128, 185 ) )
  1487.        
  1488.         SetMaterial( Material( "gui/gradient_up" ) );
  1489.         SetDrawColor( Color( 0, 0, 0, 127.5 ) );
  1490.         DrawTexturedRect( 1, 1, self:GetWide() - 1, 24, 0 );
  1491.        
  1492.         self.btnClose:SetVisible( true )
  1493.        
  1494.         self.btnClose.Paint = function()
  1495.             if not ( G ) then  
  1496.                 return
  1497.             end
  1498.            
  1499.             SetTextColor( 255, 255, 255, 255 )
  1500.             SetDrawColor( 0, 0, 0, 255 )
  1501.             SetTextPos( 18, 6 )
  1502.             SetFont( "BudgetLabel" )
  1503.             DrawText( "-" )
  1504.         end
  1505.        
  1506.         self.Close = function()
  1507.             self:SetVisible( false )
  1508.         end
  1509.     end
  1510.  
  1511.     vgui.Register( "GFrame", G.Theme.Panel, "DFrame" )
  1512.    
  1513.     function G.DrawConsole()       
  1514.         G.Panels.Console.Panel = vgui.Create( "GFrame" )
  1515.         local Panel = G.Panels.Console.Panel
  1516.        
  1517.         local gw, gt, x, y = Panel:GetWide(), Panel:GetTall(), ScrW() / 2, ScrH() / 2
  1518.         local w, h = ScrW(), ScrH()
  1519.        
  1520.         Panel:SetSize( 300, 65 )
  1521.         Panel:SetPos( w - h - 10, gw - gt - ( gw - gt ) + 10 )
  1522.         Panel:SetTitle( "Mini Console" )
  1523.         Panel:SetVisible( false )
  1524.         Panel:SetDraggable( true )
  1525.         Panel:ShowCloseButton( true )
  1526.        
  1527.         G.Panels.Console.Frame = vgui.Create( "DPanel" )
  1528.         local Frame = G.Panels.Console.Frame
  1529.        
  1530.         Frame:SetVisible( false )
  1531.         Frame:SetParent( Panel )
  1532.         Frame:SetPos( 5, 30 )
  1533.         Frame:SetSize( 290, 30 )
  1534.        
  1535.         G.Panels.Console.TextBox = vgui.Create( "DTextEntry" )
  1536.         local TextEntry = G.Panels.Console.TextBox
  1537.        
  1538.         TextEntry:SetVisible( false )
  1539.         TextEntry:SetParent( Panel )
  1540.         TextEntry:SetPos( 10, Panel:GetTall() - 30 )
  1541.         TextEntry:SetWide( Panel:GetWide() - 20 )
  1542.        
  1543.         TextEntry.OnEnter = function()
  1544.             G.Console.Input( TextEntry:GetValue() )
  1545.         end
  1546.     end
  1547.    
  1548.     function G.TogglePanelVisiblity( bool )
  1549.         local MenuOpen = bool and not bool or G.FAV[4]
  1550.        
  1551.         for k, v in loop, G.Panels do
  1552.             for l, b in loop, v do
  1553.                 if not ( IsValid( b ) ) or not ( ValidPanel( b ) ) then
  1554.                     return
  1555.                 end
  1556.                
  1557.                 b:SetVisible( not MenuOpen )
  1558.             end
  1559.         end
  1560.        
  1561.         if not ( bool ) then // Open all panels with the name Panel
  1562.             for k, v in loop, G.Panels do
  1563.                 for l, b in loop, v do
  1564.                     if not ( IsValid( b ) ) or not ( ValidPanel( b ) ) then
  1565.                         return
  1566.                     end
  1567.                    
  1568.                     if ( l == "Panel" ) then
  1569.                         b:MakePopup()
  1570.                     end
  1571.                 end
  1572.             end
  1573.         end
  1574.    
  1575.         gui.EnableScreenClicker( not MenuOpen )
  1576.        
  1577.         G.FAV[4] = not MenuOpen
  1578.     end
  1579.    
  1580.     function G.NiceTabName( name )
  1581.         return G.SettingsPrefixs[ name ]
  1582.     end
  1583.    
  1584.     function G.CreateSettingsMenus()       
  1585.         G.Panels.SettingsMenu.Panel = vgui.Create( "GFrame" )
  1586.         local Panel = G.Panels.SettingsMenu.Panel
  1587.        
  1588.         local gw, gt, x, y = Panel:GetWide(), Panel:GetTall(), ScrW() / 2, ScrH() / 2
  1589.         local w, h = ScrW(), ScrH()
  1590.        
  1591.         Panel:SetSize( 300, 800 )
  1592.         Panel:SetPos( w - h - 320, gw - gt - ( gw - gt ) + 10 )
  1593.         Panel:SetTitle( "Settings" )
  1594.         Panel:SetVisible( false )
  1595.         Panel:SetDraggable( true )
  1596.         Panel:ShowCloseButton( true )
  1597.        
  1598.         G.Panels.SettingsMenu.Frame = vgui.Create( "DPanel" )
  1599.         local Frame = G.Panels.SettingsMenu.Frame
  1600.        
  1601.         Frame:SetVisible( false )
  1602.         Frame:SetParent( Panel )
  1603.         Frame:SetPos( 5, 30 )
  1604.         Frame:SetSize( 290, 765 )
  1605.        
  1606.         G.Panels.SettingsMenu.Settings = vgui.Create( "DProperties" )
  1607.         local DProperties = vgui.Create( "DProperties" )
  1608.        
  1609.         DProperties:SetParent( Panel )
  1610.         DProperties:SetSize( 280, 1000 )
  1611.         DProperties:SetPos( 10, 35 )
  1612.                
  1613.         local tab = {
  1614.             [ "aim" ] = {},
  1615.             [ "esp" ] = {},
  1616.             [ "mis" ] = {} // Misc
  1617.         }
  1618.        
  1619.         for k, v in loop, G.Settings do
  1620.             local key = string.sub( k, 1, 3 )
  1621.             tab[ key ][ k ] = v
  1622.         end
  1623.        
  1624.         for k, v in loop, tab do
  1625.             local short = string.sub( k, 1, 3 )
  1626.             local nicename = G.NiceTabName( short )
  1627.            
  1628.             for l, b in loop, v do
  1629.                 local row = DProperties:CreateRow( nicename, l )
  1630.                 row:Setup( "Float", { min = 0, max = 999 } )
  1631.                 row:SetValue( b[ 2 ] )
  1632.                
  1633.                 row.DataChanged = function( self, _val )
  1634.                     local val = math.floor( _val )
  1635.                     G.SetSetting( l, val )
  1636.                 end
  1637.             end
  1638.         end
  1639.     end
  1640.    
  1641.     function G.Library.CreateVGUIElements()
  1642.         hook.Add( "Think", "_____waitforsettings", function() // Because I love archaic iteration
  1643.             if ( G.FAV[13] ) then
  1644.                 G.DrawConsole()
  1645.                 G.CreateSettingsMenus()
  1646.             end
  1647.            
  1648.             hook.Remove( "Think", "_____waitforsettings" )
  1649.         end )
  1650.     end
  1651.    
  1652.     function G.Library.NotifyHooks()
  1653.         MsgN( " " ) // Spacer
  1654.        
  1655.         for k, v in loop, G.HookFuncs do
  1656.             for l, func in loop, v do
  1657.                 G.LogConsole( "[ Library ] [ NotifyHooks ] [ HookGFuncs ] [ " .. l .. " ] will be called with [ " .. k .. " ]" )
  1658.             end
  1659.         end
  1660.        
  1661.         MsgN( " " ) // Spacer
  1662.     end
  1663.    
  1664.     function G.CheatInit() // TODO: Add spacers automatically when a library finishes loading
  1665.         if ( CHANGE_ME1 == "change_me_please" or CHANGE_ME2 == "change_me_please" ) then
  1666.             G.LogChat( "You did not change CHANGE_ME1 and or CHANGE_ME2, aborting." )
  1667.            
  1668.             return
  1669.         end
  1670.        
  1671.         local s
  1672.         local e
  1673.        
  1674.         for k, v in loop, G.Library do
  1675.             s, e = pcall( v )
  1676.            
  1677.             if ( s ) then
  1678.                 G.LogConsole( "[ Library ] [ " .. k .. " ] Library loaded successfully" )
  1679.             else
  1680.                 G.LogConsole( "[ Library ] [ " .. k .. " ] Library failed to load [ " .. e .. " ]" )
  1681.             end
  1682.         end
  1683.        
  1684.         MsgN( " " ) // Spacer
  1685.        
  1686.         G.LogChat( "Cheat initialized" )
  1687.     end
  1688.    
  1689.     G.CheatInit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement