Guest User

Untitled

a guest
Jan 25th, 2015
1,638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.53 KB | None | 0 0
  1. -- NiCeeee
  2.  
  3. local S = {
  4.     [ "Detours" ] = {
  5.         [ "OldFunctions" ] = {}
  6.     },
  7.     [ "Hooks" ] = {},
  8.     [ "FontMenu" ] = {
  9.         [ "font" ]      = "DermaDefault",
  10.         [ "size" ]      = 50,
  11.         [ "weight" ]    = 500,
  12.         [ "blursize" ]  = 0,
  13.         [ "scanlines" ] = 0,
  14.         [ "antialias" ] = true,
  15.         [ "shadow" ]    = false
  16.     },
  17.     [ "FontESP" ] = {
  18.         [ "font" ]      = "ChatFont",
  19.         [ "size" ]      = 16,
  20.         [ "weight" ]    = 500,
  21.         [ "blursize" ]  = 0,
  22.         [ "scanlines" ] = 0,
  23.         [ "antialias" ] = false,
  24.         [ "shadow" ]    = true
  25.     },
  26.     [ "Delays" ] = {}
  27. }
  28.  
  29. -- Delay Enumerations --
  30.  
  31. local DELAY_NONE = 1
  32. local DELAY_DETOUR = 2
  33.  
  34. -- Init --
  35.  
  36. function S.DoDelayed( typ, name, func )
  37.     S.Delays[ name ] = { typ, name, func }
  38. end
  39.  
  40. function S.Init()
  41.     for k, tab in pairs( S.Delays ) do
  42.         local typ = tab[ 1 ]
  43.         local name = tab[ 2 ]
  44.         local func = tab[ 3 ]
  45.        
  46.         if ( typ == DELAY_DETOUR ) then
  47.             S.DoDetourStuff( name, func )
  48.            
  49.             continue
  50.         end
  51.        
  52.         func()
  53.     end
  54. end
  55.  
  56. function S.ShutDown()
  57.     local prefix = ""
  58.    
  59.     for k, v in pairs( S.Detours.OldFunctions ) do
  60.         local tab = string.Explode( ".", k )
  61.        
  62.         _G[ tab[ 1 ] ][ tab[ 2 ] ] = v -- you will need to update this if the function you are overriding is more than one table deep (not including _G)
  63.        
  64.         prefix = S.DoDetourStuff( k, nil, "Removed" ) -- Le cause i wanted tew :#3)>
  65.     end
  66.    
  67.     MsgC( Color( 75, 120, 255 ), prefix .. ' - ', Color( 75, 136, 255 ), 'Cheat unloaded' .. '\n' )
  68.    
  69.     S = nil
  70. end
  71.  
  72. -- Detours --
  73.  
  74. function S.Detour( name, oldfunc, newfunc )
  75.     S.Detours[ "OldFunctions" ][ name ] = oldfunc
  76.    
  77.     local dfunc = function( ... )
  78.         newfunc( ... )
  79.        
  80.         return oldfunc( ... )
  81.     end
  82.    
  83.     return dfunc
  84. end
  85.  
  86. function S.DoDetourStuff( name, func, argtyp )
  87.     local prefix = "lmao"
  88.     local typ = argtyp or "Created"
  89.  
  90.     MsgC( Color( 75, 120, 255 ), prefix .. ' - ', Color( 75, 136, 255 ), typ .. ' detour "' .. name .. '"' .. '\n' )
  91.    
  92.     if ( func ) then
  93.         func( name )
  94.     else
  95.         return prefix
  96.     end
  97. end
  98.  
  99. -- Hooking --
  100.  
  101. local function DetouredHookCall( name, ... )
  102.     if ( S.Hooks[ name ] ) then
  103.         S.Hooks[ name ]( ... )
  104.     end
  105. end
  106.  
  107. S.DoDelayed( DELAY_DETOUR, "hook.Call", function( name )
  108.     hook.Call = S.Detour( name, hook.Call, DetouredHookCall )
  109. end )
  110.  
  111. -- Font --
  112.  
  113. S.DoDelayed( DELAY_NONE, "CreateFont", function()
  114.     surface.CreateFont( "yolo", S.FontMenu )
  115.     surface.CreateFont( ":^)", S.FontESP )
  116. end )
  117.  
  118. -- ESP --
  119.  
  120. function S.ESP()
  121.     local name_enabled = S.GetMenuSetting( "esp", "name" )
  122.     local health_enabled = S.GetMenuSetting( "esp", "health" )
  123.     local rank_enabled = S.GetMenuSetting( "esp", "rank" )
  124.     local box_enabled = S.GetMenuSetting( "esp", "box" )
  125.    
  126.     if not ( name_enabled ) and not ( health_enabled ) and not ( rank_enabled ) and not ( box_enabled ) then
  127.         return
  128.     end
  129.    
  130.     local w = pcall( function() -- test da font 2 make suer it werkededs:)
  131.         draw.DrawText( "", ":^)", 0, 0, Color( 255, 255, 255, 255 ) )
  132.     end )
  133.    
  134.     if not ( w ) then
  135.         return
  136.     end
  137.    
  138.     for k, v in pairs( player.GetAll() ) do
  139.         if ( v == LocalPlayer() ) then continue end
  140.         if ( v:Health() <= 0 ) then continue end
  141.         if ( v:GetColor().a < 255 ) then continue end
  142.    
  143.         local pos = v:GetPos():ToScreen() or cam.End3D2D()
  144.        
  145.         local nick = v:Nick() or ""
  146.         local health = v:Health() or 0
  147.         local rank = v:GetUserGroup() or ""
  148.        
  149.         local coln = team.GetColor( v:Team() ) or Color( 255, 255, 255, 255 )
  150.         local colh = HSVToColor( health / 100 * 120, 1, 1 ) or Color( 255, 255, 255, 255 )
  151.         local colr = ( rank ~= "user" and Color( 128, 128, 0, 255 ) ) or Color( 0, 255, 0, 255 )
  152.        
  153.         if ( name_enabled ) and not ( health_enabled ) and not ( rank_enabled ) then
  154.        
  155.         elseif ( rank_enabled ) and not ( name_enabled ) and not ( health_enabled ) then
  156.        
  157.         elseif ( name_enabled ) and ( rank_enabled ) and not ( health_enabled ) then
  158.             nick = nick .. "|"
  159.         else
  160.             nick = nick .. "|"
  161.             health = "(" .. tostring( health ) .. ")"
  162.             rank = "|" .. rank
  163.         end
  164.        
  165.         local incr = 0
  166.         local old_x = pos.x
  167.        
  168.         surface.SetFont( ":^)" )
  169.        
  170.         local nick_w = ( name_enabled and select( 1, surface.GetTextSize( nick ) ) ) or 0      
  171.         local health_w = ( health_enabled and select( 1, surface.GetTextSize( health ) ) ) or 0
  172.         local rank_w = ( rank_enabled and select( 1, surface.GetTextSize( rank ) ) ) or 0
  173.        
  174.         pos.x = pos.x - ( nick_w + health_w + rank_w ) / 2
  175.        
  176.         if ( name_enabled ) then
  177.             draw.DrawText( nick, ":^)", pos.x + incr, pos.y, coln, TEXT_ALIGN_LEFT )
  178.            
  179.             incr = incr + nick_w
  180.         end
  181.        
  182.         if ( health_enabled ) then
  183.             draw.DrawText( health, ":^)", pos.x + incr, pos.y, colh, TEXT_ALIGN_LEFT )
  184.            
  185.             incr = incr + health_w
  186.         end
  187.        
  188.         if ( rank_enabled ) then
  189.             draw.DrawText( rank, ":^)", pos.x + incr, pos.y, colr, TEXT_ALIGN_LEFT )
  190.         end
  191.        
  192.         pos.x = old_x
  193.        
  194.         -- warning if u r reading the codes below u r gay cause i dId not make them til i make my own box esp ... OK! i am copy paste king u dont dney :)
  195.        
  196.         if ( box_enabled ) then
  197.             local Min, Max = v:GetCollisionBounds()
  198.            
  199.             local one = v:LocalToWorld(Min):ToScreen()
  200.             local two = v:LocalToWorld(Vector(Min.x, Min.y, Max.z)):ToScreen()
  201.             local three = v:LocalToWorld(Vector(Min.x, Min.y + (Max.y * 2), Min.z)):ToScreen()
  202.             local four = v:LocalToWorld(Vector(Min.x + (Max.x * 2), Min.y, Min.z)):ToScreen()
  203.            
  204.             local five = v:LocalToWorld(Max):ToScreen()
  205.             local six = v:LocalToWorld(Vector(Max.x, Max.y, Min.z)):ToScreen()
  206.             local seven = v:LocalToWorld(Vector(Max.x, Max.y + (Min.y * 2), Max.z)):ToScreen()
  207.             local eight = v:LocalToWorld(Vector(Max.x + (Min.x * 2), Max.y, Max.z)):ToScreen()             
  208.            
  209.             surface.SetDrawColor(coln)
  210.            
  211.             local function connect(tabone, tabtwo)
  212.                 surface.DrawLine(tabone.x, tabone.y, tabtwo.x, tabtwo.y)
  213.             end
  214.            
  215.             connect(one, two)
  216.             connect(three, eight)
  217.             connect(four, seven)
  218.             connect(six, five)
  219.             connect(four, six)
  220.             connect(four, one)
  221.             connect(one, three)
  222.             connect(three, six)
  223.             connect(five, eight)
  224.             connect(eight, two)
  225.             connect(two, seven)
  226.             connect(seven, five)
  227.         end
  228.     end
  229. end
  230.  
  231. -- !!! WARNING !!! everyting belowe da codens r lazy l0l ;^)
  232.  
  233. -- Menu [ (name/enabled/length) ] --
  234.  
  235. local MenuParents = {
  236.     [ 1 ] = {
  237.         [ "Name" ] = "aimbot",
  238.         [ "LongestWidth" ] = 0,
  239.         [ "Elements" ] = {
  240.             { "abcdefeeea", false, 0 };
  241.             { "abcdefe", false, 0 };
  242.         }
  243.     },
  244.     [ 2 ] = {
  245.         [ "Name" ] = "esp",
  246.         [ "LongestWidth" ] = 0,
  247.         [ "Elements" ] = {
  248.             { "name", false, 0 };
  249.             { "health", false, 0 };
  250.             { "rank", false, 0 };
  251.             { "box", false, 0 };
  252.         }
  253.     },
  254.     [ 3 ] = {
  255.         [ "Name" ] = "visuals",
  256.         [ "LongestWidth" ] = 0,
  257.         [ "Elements" ] = {
  258.             { "abcdefasdfasfd", false, 0 };
  259.             { "abcdefffffffffff", false, 0 };
  260.             { "abcdeddf", false, 0 };
  261.         }
  262.     },
  263.     [ 4 ] = {
  264.         [ "Name" ] = "misc",
  265.         [ "LongestWidth" ] = 0,
  266.         [ "Elements" ] = {
  267.             { "abcdfdfddef", false, 0 };
  268.             { "abcdeasdf", false, 0 };
  269.             { "abcfdddef", false, 0 };
  270.             { "abcfdddef", false, 0 };
  271.             { "heeeeeeeeeeeeeey", false, 0 };
  272.         }
  273.     }
  274. }
  275.  
  276. function S.FindParentByName( name )
  277.     for k, v in pairs( MenuParents ) do
  278.         if ( v[ "Name" ] == name ) then
  279.             return v
  280.         end
  281.     end
  282. end
  283.  
  284. function S.GetMenuSetting( sub, name )
  285.     local tab = S.FindParentByName( sub )
  286.    
  287.     if ( tab ) then
  288.         for i = 1, #tab[ "Elements" ] do
  289.             if ( tab[ "Elements" ][ i ][ 1 ] == name ) then
  290.                 return tab[ "Elements" ][ i ][ 2 ]
  291.             end
  292.         end
  293.     end
  294. end
  295.  
  296. S.DoDelayed( DELAY_NONE, "GetHighs", function() -- this should be named GetWidths etc but wat do i cereal
  297.     local highs = {}
  298.  
  299.     for k, v in pairs( MenuParents ) do
  300.         local elements = v[ "Elements" ]
  301.        
  302.         for l, b in pairs( elements ) do
  303.             surface.SetFont( "yolo" )
  304.            
  305.             local w = select( 1, surface.GetTextSize( b[ 1 ] ) )
  306.            
  307.             MenuParents[ k ][ "Elements" ][ l ][ 3 ] = w
  308.            
  309.             highs[ k ] = highs[ k ] or {}
  310.             highs[ k ][ l ] = w
  311.         end
  312.     end
  313.  
  314.     local high = 0
  315.  
  316.     for k, v in pairs( highs ) do
  317.         for l, b in pairs( v ) do
  318.             if ( b > high ) then
  319.                 high = b
  320.             end
  321.            
  322.             if ( l == #v ) then
  323.                 MenuParents[ k ][ "LongestWidth" ] = high
  324.             end
  325.         end
  326.     end
  327. end )
  328.  
  329. local open = false
  330. local WaitTime = 0
  331. local LWaitTime = 0
  332.  
  333. local cur = 1
  334. local ocur = 0
  335. local curn = -1
  336. local curnmt = 0
  337.  
  338. local cursub = {}
  339.  
  340. local open_delay = 0.5
  341. local switch_delay = 0.175
  342.  
  343. local function DrawMenuText( text, offset )
  344.     draw.SimpleText( text, "yolo", 5 + 1, ScrH() / 4 + 50 + offset + 1, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT )
  345.     draw.SimpleText( text, "yolo", 5, ScrH() / 4 + 50 + offset, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT )
  346. end
  347.  
  348. local function DrawSubText( text, offset )
  349.     draw.SimpleText( text, "yolo", 210 + 1, ScrH() / 4 + 50 + offset + 1, Color( 0, 0, 0, 255 ), TEXT_ALIGN_LEFT )
  350.     draw.SimpleText( text, "yolo", 210, ScrH() / 4 + 50 + offset, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT )
  351. end
  352.  
  353. local function CalculateNextPosition( n, t, h ) -- number, type, high
  354.     if not ( ( n == h and t == 1 ) ) and not ( ( n == 1 and t == 2 ) ) then
  355.         n = ( ( t == 1 ) and ( n + 1 ) or ( n - 1 ) )
  356.     else
  357.         if ( n == h ) then
  358.             n = 1
  359.         else
  360.             n = h
  361.         end
  362.     end
  363.    
  364.     return n
  365. end
  366.  
  367. function S.Hooks.DrawOverlay()
  368.     S.ESP()
  369.    
  370.     if ( input.IsKeyDown( KEY_DELETE ) ) then
  371.         S.ShutDown()
  372.        
  373.         return
  374.     end
  375.  
  376.     if ( RealTime() > WaitTime ) and ( input.IsKeyDown( KEY_INSERT ) ) then
  377.         WaitTime = RealTime() + open_delay
  378.        
  379.         open = not open
  380.     end
  381.    
  382.     if not ( open ) then
  383.         return
  384.     end
  385.    
  386.     local w = 200
  387.     local h = 50
  388.    
  389.     if ( RealTime() > LWaitTime ) then
  390.         if ( ( input.IsKeyDown( KEY_UP ) or ( input.IsKeyDown( KEY_DOWN ) ) ) ) then
  391.             LWaitTime = RealTime() + switch_delay
  392.            
  393.             local typ = input.IsKeyDown( KEY_DOWN ) and 1 or 2
  394.             local high = cur ~= -1 and #MenuParents or #cursub
  395.            
  396.             if ( cur == -1 ) then
  397.                 curnmt = CalculateNextPosition( curnmt, typ, high )
  398.             else
  399.                 cur = CalculateNextPosition( cur, typ, high )
  400.             end
  401.         end
  402.        
  403.         if ( input.IsKeyDown( KEY_RIGHT ) ) then
  404.             LWaitTime = RealTime() + ( switch_delay * 1.5 )
  405.            
  406.             if ( cur ~= -1 ) then
  407.                 curn = cur
  408.                 ocur = cur
  409.                 cur = -1
  410.                 curnmt = 1
  411.                 cursub = MenuParents[ ocur ][ "Elements" ]
  412.             else
  413.                 MenuParents[ ocur ][ "Elements" ][ curnmt ][ 2 ] = not MenuParents[ ocur ][ "Elements" ][ curnmt ][ 2 ]
  414.             end
  415.         end
  416.        
  417.         if ( input.IsKeyDown( KEY_LEFT ) ) then
  418.             LWaitTime = RealTime() + switch_delay
  419.            
  420.             if ( curn ~= -1 ) then
  421.                 curn = -1
  422.                 cur = ocur
  423.             end
  424.         end
  425.     end
  426.    
  427.     for i, v in pairs( MenuParents ) do
  428.         surface.SetDrawColor( 192, 192, 192, 200 )
  429.  
  430.         for m = 1, #MenuParents do
  431.             if ( i == m ) then
  432.                 if ( ( cur ~= -1 and cur or ocur ) == m ) then
  433.                     surface.SetDrawColor( 5, 5, 5, 200 )
  434.                 else
  435.                     surface.SetDrawColor( 192, 192, 192, 200 )
  436.                 end
  437.                
  438.                 surface.DrawRect( -1, ScrH() / 4 + ( i * h ), w, h )
  439.             end
  440.         end
  441.     end
  442.    
  443.     if ( curn ~= -1 ) then
  444.         local elements = cursub
  445.         local subnum = 0
  446.        
  447.         for i = 1, #elements do
  448.             local hwidth = MenuParents[ ocur ][ "LongestWidth" ] + 16
  449.             local cursubelm = elements[ i ]
  450.            
  451.             if ( curnmt == i ) then
  452.                 surface.SetDrawColor( 5, 5, 5, 200 )
  453.             else
  454.                 surface.SetDrawColor( 192, 192, 192, 200 )
  455.             end
  456.            
  457.             surface.DrawRect( -1 + w, ScrH() / 4 + ( i * h ), hwidth, h )
  458.            
  459.             DrawSubText( cursubelm[ 1 ], subnum - 5 )
  460.            
  461.             if ( cursubelm[ 2 ] ) then
  462.                 surface.SetDrawColor( 0, 255, 0, 155 )
  463.             else
  464.                 surface.SetDrawColor( 255, 0, 0, 155 )
  465.             end
  466.            
  467.             surface.DrawRect( -1 + w, ScrH() / 4 + ( i * h ), 8, h )
  468.            
  469.             subnum = subnum + h
  470.         end
  471.     end
  472.    
  473.     local stepnum = 0
  474.    
  475.     for i = 1, #MenuParents do
  476.         DrawMenuText( MenuParents[ i ][ "Name" ], stepnum - 5 )
  477.        
  478.         stepnum = stepnum + h
  479.     end
  480. end
  481.  
  482. S.Init()
Advertisement
Add Comment
Please, Sign In to add comment