Advertisement
spinsquad

rakbot leak

Mar 22nd, 2015
994
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 38.23 KB | None | 0 0
  1. --[[
  2. so apparently some kid called "prodiigy" or something made this, had this laying around somewhere, xray doenst work iirc, have fun with this shit
  3.  
  4. http://steamcommunity.com/profiles/76561197960284155
  5. ]]
  6.  
  7. -- VARIABLES
  8.  
  9. local RakBotSayPrefix = CreateClientConVar( "rak_bot_sayprefix", "", true, false )
  10. local RakBotSayDelay = 0
  11.  
  12. local RakBotOn = CreateClientConVar( "rak_bot_on", 1, true, false )
  13. local RakBotHealth = CreateClientConVar( "rak_bot_health", 1, true, false )
  14. local RakBotWeapon = CreateClientConVar( "rak_bot_weapon", 1, true, false )
  15. local RakBotMoney = CreateClientConVar( "rak_bot_money", 1, true, false )
  16. local RakBotDistance = CreateClientConVar( "rak_bot_distance", 1, true, false )
  17. local RakBotSpeed = CreateClientConVar( "rak_bot_speed", 1, true, false )
  18.  
  19. local RakBotMirror = CreateClientConVar( "rak_bot_mirror", 0, true, false )
  20. local RakBotMirrorx = CreateClientConVar( "rak_bot_mirrorx", 0, true, false )
  21. local RakBotMirrory = CreateClientConVar( "rak_bot_mirrory", 0, true, false )
  22. local RakBotMirrorw = CreateClientConVar( "rak_bot_mirrorw", 300, true, false )
  23. local RakBotMirrorh = CreateClientConVar( "rak_bot_mirrorh", 300, true, false )
  24. local RakBotMirrorpitch = CreateClientConVar( "rak_bot_mirrorpitch", -2, true, false )
  25. local RakBotMirroryaw = CreateClientConVar( "rak_bot_mirroryaw", 180, true, false )
  26. local RakBotMirrorroll = CreateClientConVar( "rak_bot_mirrorroll", 0, true, false )
  27.  
  28. local RakBotRadar = CreateClientConVar( "rak_bot_radar", 0, true, false )
  29. local RakBotRadarx = CreateClientConVar( "rak_bot_radarx", 0, true, false )
  30. local RakBotRadary = CreateClientConVar( "rak_bot_radary", 0, true, false )
  31. local RakBotRadarw = CreateClientConVar( "rak_bot_radarw", 300, true, false )
  32. local RakBotRadarh = CreateClientConVar( "rak_bot_radarh", 300, true, false )
  33. local RakBotRadarfov = CreateClientConVar( "rak_bot_radarfov", 300, true, false )
  34. local RakBotRadarauto = CreateClientConVar( "rak_bot_radarauto", 1, true, false )
  35.  
  36. local RakBotAimdot = CreateClientConVar( "rak_bot_aimdot", 0, true, false )
  37. local RakBotAimdotfilt = CreateClientConVar( "rak_bot_aimdotfilter", 1, true, false )
  38.  
  39. local RakBotLight = false
  40. local RakBotAura = false
  41. local RakBotToggleCommands = {}
  42.  
  43. local RakBotVoteTime = CreateClientConVar( "rak_bot_votetime", 120, true, false )
  44. local RakBotVoteVoted = {}
  45. local RakBotVoteVotes = {}
  46. local RakBotVoteType = 0
  47.  
  48. local RakBotDetects = {}
  49. local RakBotDetected = {}
  50. local RakBotDetectShow = CreateClientConVar( "rak_bot_detectshow", 1, true, false )
  51. local RakBotDetectShowRad = CreateClientConVar( "rak_bot_detectshowrad", 0, true, false )
  52. local RakBotDetectThreshold = CreateClientConVar( "rak_bot_detectthresh", 100, true, false )
  53. local RakBotDetectTrace = CreateClientConVar( "rak_bot_detecttrace", 0, true, false )
  54.  
  55. local RakBotXRay = false
  56. local RakBotXRayMat = CreateClientConVar( "rak_bot_xraymat", "xraysolid", true, false )
  57. local RakBotXRayColors = {}
  58. local RakBotXRayMats = {}
  59.  
  60. local RakBotReverseChat = CreateClientConVar( "rak_bot_chatreverse", 0, true, false )
  61. local RakBotCambChat = CreateClientConVar( "rak_bot_chatcambridge", 0, true, false )
  62. local RakBotByteChat = CreateClientConVar( "rak_bot_chatbyte", 0, true, false )
  63.  
  64.  
  65. -- ENTITY SAVING
  66.  
  67. local RakBotObjectsConvar = CreateClientConVar( "rak_bot_objects", "", true, false )
  68. local RakBotObjects = {}
  69. if RakBotObjectsConvar:GetString() ~= "" then
  70.     RakBotObjects = string.Explode( "|", RakBotObjectsConvar:GetString() )
  71. end
  72.  
  73. -- UTILITY
  74.  
  75. local function RakBotGetOffset( ply )
  76.     if !IsValid( ply ) then return Vector( 0, 0, 0 ) end
  77.     if !ply:GetAttachment( ply:LookupAttachment( "eyes" ) ) then
  78.         return ply:GetShootPos():ToScreen()
  79.     else
  80.         return ply:GetAttachment( ply:LookupAttachment( "eyes" ) ).Pos:ToScreen()
  81.     end
  82. end
  83.  
  84. local function RakBotSay( text )
  85.     if string.len( RakBotSayPrefix:GetString() .. text ) > 125 then
  86.         timer.Simple( 2 * ( RakBotSayDelay + 1 ), RakBotSay, string.sub( RakBotSayPrefix:GetString() .. text, 127 ) )
  87.     end
  88.     timer.Simple( 2 * RakBotSayDelay, function()
  89.         RakBotSayDelay = RakBotSayDelay - 1
  90.         RunConsoleCommand( "say", RakBotSayPrefix:GetString() .. text )
  91.     end )
  92.     RakBotSayDelay = RakBotSayDelay + 1
  93. end
  94.  
  95. -- MAIN DRAWING
  96.  
  97. local function RakBotDraw()
  98.     if RakBotAimdot:GetInt() > 0 then
  99.         for _, v in pairs( player.GetAll() ) do
  100.             if RakBotAimdotfilt:GetInt() > 0 then
  101.                 if !util.TraceLine( { start = LocalPlayer():GetShootPos(), endpos = v:GetEyeTrace().HitPos, filter = LocalPlayer() } ).Hit and v ~= LocalPlayer() then
  102.                     local o = v:GetEyeTrace().HitPos:ToScreen()
  103.                     surface.SetDrawColor( 0, 0, 0, 255 )
  104.                     surface.DrawRect( o.x - 2, o.y - 2, 4, 4 )
  105.                     local col = team.GetColor( v:Team() )
  106.                     surface.SetDrawColor( col.r, col.g, col.b, 255 )
  107.                     surface.DrawRect( o.x - 1, o.y - 1, 2, 2 )
  108.                    
  109.                     surface.SetDrawColor( 0, 0, 0, 50 )
  110.                     surface.SetFont( "Default" )
  111.                     surface.DrawRect( o.x - surface.GetTextSize( v:Nick() ) / 2, o.y + 7, surface.GetTextSize( v:Nick() ) + 2, 12 )
  112.                     surface.SetTextColor( 255, 255, 255, 255 )
  113.                     surface.SetTextPos( o.x - ( surface.GetTextSize( v:Nick() ) ) / 2 + 1, o.y + 6 )
  114.                     surface.DrawText( v:Nick() )
  115.                 end
  116.             else
  117.                 if v ~= LocalPlayer() then
  118.                     local o = v:GetEyeTrace().HitPos:ToScreen()
  119.                     surface.SetDrawColor( 0, 0, 0, 255 )
  120.                     surface.DrawRect( o.x - 2, o.y - 2, 4, 4 )
  121.                     local col = team.GetColor( v:Team() )
  122.                     surface.SetDrawColor( col.r, col.g, col.b, 255 )
  123.                     surface.DrawRect( o.x - 1, o.y - 1, 2, 2 )
  124.                    
  125.                     surface.SetDrawColor( 0, 0, 0, 50 )
  126.                     surface.SetFont( "Default" )
  127.                     surface.DrawRect( o.x - surface.GetTextSize( v:Nick() ) / 2, o.y + 7, surface.GetTextSize( v:Nick() ) + 2, 12 )
  128.                     surface.SetTextColor( 255, 255, 255, 255 )
  129.                     surface.SetTextPos( o.x - ( surface.GetTextSize( v:Nick() ) ) / 2 + 1, o.y + 6 )
  130.                     surface.DrawText( v:Nick() )
  131.                 end
  132.             end
  133.         end
  134.     end
  135.     if RakBotOn:GetInt() > 0 then
  136.         for _, v in pairs( RakBotObjects ) do
  137.             if v ~= "" then
  138.                 for k, b in pairs( ents.GetAll() ) do
  139.                     if string.find( string.lower( b:GetClass() ), string.lower( v ) ) then
  140.                         local o = b:GetPos():ToScreen()
  141.                         surface.SetDrawColor( 0, 0, 0, 255 )
  142.                         surface.DrawRect( o.x - 6, o.y - 6, 12, 12 )
  143.                         surface.SetDrawColor( 255, 255, 255, 255 )
  144.                         surface.DrawRect( o.x - 5, o.y - 5, 10, 10 )
  145.                        
  146.                         surface.SetFont( "Default" )
  147.                        
  148.                         surface.SetDrawColor( 0, 0, 0, 50 )
  149.                         surface.DrawRect( o.x + 12, o.y - 6, surface.GetTextSize( b:GetClass() ) + 2, 12 )
  150.                         surface.SetTextColor( 255, 255, 255, 255 )
  151.                         surface.SetTextPos( o.x + 13, o.y - 7 )
  152.                         surface.DrawText( b:GetClass() )
  153.                        
  154.                         surface.SetDrawColor( 0, 0, 0, 50 )
  155.                         surface.SetFont( "Default" )
  156.                         surface.DrawRect( o.x - 6, o.y - 19, surface.GetTextSize( "D: " .. math.floor( b:GetPos():Distance( LocalPlayer():GetPos() ) ) ) + 2, 12 )
  157.                         surface.SetTextColor( 255, 255, 255, 255 )
  158.                         surface.SetTextPos( o.x - 5, o.y - 20 )
  159.                         surface.DrawText( "D: " .. math.floor( b:GetPos():Distance( LocalPlayer():GetPos() ) ) )
  160.                     end
  161.                 end
  162.             end
  163.         end
  164.         for _, v in pairs( player.GetAll() ) do
  165.             if v:Alive() and v ~= LocalPlayer() then
  166.                 local o = RakBotGetOffset( v )
  167.                
  168.                 if v:GetPos():Distance( LocalPlayer():GetPos() ) < 500 then
  169.                     o.y = o.y - ( 100 - v:GetPos():Distance( LocalPlayer():GetPos() ) / 5 )
  170.                 end
  171.                
  172.                 local color = team.GetColor( v:Team() )
  173.                 surface.SetDrawColor( 0, 0, 0, 255 )
  174.                 surface.DrawRect( o.x - 6, o.y - 6, 12, 12 )
  175.                 surface.SetDrawColor( 0, 0, 255, 255 )
  176.                 if v:IsSuperAdmin() then
  177.                     surface.SetDrawColor( 255, 0, 0, 255 )
  178.                 elseif v:IsAdmin() then
  179.                     surface.SetDrawColor( 0, 255, 0, 255 )
  180.                 end
  181.                 surface.DrawRect( o.x - 5, o.y - 5, 10, 10 )
  182.                 surface.SetDrawColor( 0, 0, 0, 255 )
  183.                 surface.DrawRect( o.x - 3, o.y - 3, 6, 6 )
  184.                 surface.SetDrawColor( color.r, color.g, color.b, 255 )
  185.                 surface.DrawRect( o.x - 2, o.y - 2, 4, 4 )
  186.                
  187.                 surface.SetFont( "Default" )
  188.                
  189.                 surface.SetDrawColor( 0, 0, 0, 50 )
  190.                 surface.DrawRect( o.x + 12, o.y - 6, surface.GetTextSize( v:Nick() ) + 2, 12 )
  191.                 surface.SetTextColor( 255, 255, 255, 255 )
  192.                 surface.SetTextPos( o.x + 13, o.y - 7 )
  193.                 surface.DrawText( v:Nick() )
  194.                
  195.                 if RakBotDistance:GetInt() > 0 then
  196.                     surface.SetDrawColor( 0, 0, 0, 50 )
  197.                     surface.SetFont( "Default" )
  198.                     surface.DrawRect( o.x - 6, o.y - 19, surface.GetTextSize( "D: " .. math.floor( v:GetPos():Distance( LocalPlayer():GetPos() ) ) ) + 2, 12 )
  199.                     surface.SetTextColor( 255, 255, 255, 255 )
  200.                     surface.SetTextPos( o.x - 5, o.y - 20 )
  201.                     surface.DrawText( "D: " .. math.floor( v:GetPos():Distance( LocalPlayer():GetPos() ) ) )
  202.                 end
  203.                
  204.                 if RakBotHealth:GetInt() > 0 then
  205.                     surface.SetDrawColor( 0, 0, 0, 50 )
  206.                     surface.SetFont( "Default" )
  207.                     surface.DrawRect( o.x - 6, o.y + 7, surface.GetTextSize( "HP: " .. v:Health() ) + 2, 12 )
  208.                     surface.SetTextColor( 255, 255, 255, 255 )
  209.                     surface.SetTextPos( o.x - 5, o.y + 6 )
  210.                     surface.DrawText( "HP: " .. v:Health() )
  211.                 end
  212.                
  213.                 if RakBotMoney:GetInt() > 0 and v:GetNetworkedInt( "Money" ) ~= 0 then
  214.                     surface.SetDrawColor( 0, 0, 0, 50 )
  215.                     surface.SetFont( "Default" )
  216.                     local add = 19
  217.                     if RakBotDistance:GetInt() > 0 then add = 32 end
  218.                     surface.DrawRect( o.x - 6, o.y - add, surface.GetTextSize( "$: " .. v:GetNWInt( "Money" ) ) + 2, 12 )
  219.                     surface.SetTextColor( 255, 255, 255, 255 )
  220.                     surface.SetTextPos( o.x - 5, o.y - add - 1 )
  221.                     surface.DrawText( "$: " .. v:GetNWInt( "Money" ) )
  222.                 end
  223.                
  224.                 if RakBotWeapon:GetInt() > 0 and v:GetActiveWeapon():IsValid() then
  225.                     surface.SetDrawColor( 0, 0, 0, 50 )
  226.                     surface.SetFont( "Default" )
  227.                     local add = 6
  228.                     if RakBotHealth:GetInt() > 0 then add = 19 end
  229.                     surface.DrawRect( o.x - 6, o.y + add + 1, surface.GetTextSize( v:GetActiveWeapon():GetPrintName() ) + 2, 12 )
  230.                     surface.SetTextColor( 255, 255, 255, 255 )
  231.                     surface.SetTextPos( o.x - 5, o.y + add )
  232.                     surface.DrawText( v:GetActiveWeapon():GetPrintName() )
  233.                 end
  234.                
  235.             end
  236.         end
  237.     end
  238.     if RakBotMirror:GetInt() > 0 then
  239.         local pitch = RakBotMirrorpitch:GetInt()
  240.         if pitch < 0 then pitch = pitch * LocalPlayer():EyeAngles().p end
  241.         local yaw = RakBotMirroryaw:GetInt()
  242.         if yaw < 0 then yaw = yaw * LocalPlayer():EyeAngles().y end
  243.         local roll = RakBotMirrorroll:GetInt()
  244.         if roll < 0 then roll = roll * LocalPlayer():EyeAngles().r end
  245.        
  246.         local Cam = {}
  247.         Cam.angles = Angle( LocalPlayer():EyeAngles().p + pitch, LocalPlayer():EyeAngles().y + yaw, LocalPlayer():EyeAngles().r + roll )
  248.         Cam.origin = LocalPlayer():GetShootPos()
  249.         Cam.x = RakBotMirrorx:GetInt()
  250.         Cam.y = RakBotMirrory:GetInt()
  251.         Cam.w = RakBotMirrorw:GetInt()
  252.         Cam.h = RakBotMirrorh:GetInt()
  253.         render.RenderView( Cam )
  254.         surface.SetDrawColor( 0, 0, 0, 255 )
  255.         surface.DrawOutlinedRect( RakBotMirrorx:GetInt(), RakBotMirrory:GetInt(), RakBotMirrorw:GetInt(),RakBotMirrorh:GetInt() )
  256.         surface.SetDrawColor( 255, 255, 255, 255 )
  257.         surface.DrawRect( ScrW() / 2 - 1, ScrH() / 2 - 1, 2, 2 )
  258.     end
  259.     if RakBotRadar:GetInt() > 0 then
  260.         local Cam = {}
  261.         Cam.angles = Angle( 90, LocalPlayer():EyeAngles().y, 0 )
  262.        
  263.         local Zvar = RakBotRadarfov:GetInt()
  264.         if RakBotRadarauto:GetInt() > 0 then
  265.             local trace = {}
  266.             trace.start = LocalPlayer():GetPos() + Vector( 0, 0, 5 )
  267.             trace.endpos = LocalPlayer():GetPos() + Vector( 0, 0, RakBotRadarfov:GetInt() )
  268.             trace.filter = LocalPlayer()
  269.             if util.TraceLine( trace ).Hit then
  270.                 Zvar = util.TraceLine( trace ).HitPos.z - 5 - LocalPlayer():GetPos().z
  271.             end
  272.         end
  273.        
  274.         Cam.origin = LocalPlayer():GetPos() + Vector( 0, 0, Zvar )
  275.         Cam.x = RakBotRadarx:GetInt()
  276.         Cam.y = RakBotRadary:GetInt()
  277.         Cam.w = RakBotRadarw:GetInt()
  278.         Cam.h = RakBotRadarh:GetInt()
  279.         render.RenderView( Cam )
  280.         surface.SetDrawColor( 0, 0, 0, 255 )
  281.         surface.DrawOutlinedRect( RakBotRadarx:GetInt(), RakBotRadary:GetInt(), RakBotRadarw:GetInt(),RakBotRadarh:GetInt() )
  282.         surface.SetDrawColor( 255, 255, 255, 255 )
  283.         surface.DrawRect( ScrW() / 2 - 1, ScrH() / 2 - 1, 2, 2 )
  284.     end
  285.     for k, v in pairs( RakBotDetects ) do
  286.         if RakBotDetectShow:GetInt() > 0 then
  287.             local o = v:ToScreen()
  288.             surface.SetDrawColor( 0, 0, 0, 255 )
  289.             surface.DrawRect( o.x - 2, o.y - 2, 4, 4 )
  290.             surface.SetDrawColor( 200, 50, 50, 255 )
  291.             surface.DrawRect( o.x - 1, o.y - 1, 2, 2 )
  292.            
  293.             surface.SetDrawColor( 0, 0, 0, 50 )
  294.             surface.SetFont( "Default" )
  295.             surface.DrawRect( o.x - surface.GetTextSize( "DET " .. k ) / 2, o.y + 7, surface.GetTextSize( "DET " .. k ) + 2, 12 )
  296.             surface.SetTextColor( 255, 255, 255, 255 )
  297.             surface.SetTextPos( o.x - ( surface.GetTextSize( "DET " .. k ) ) / 2 + 1, o.y + 6 )
  298.             surface.DrawText( "DET " .. k )
  299.             if RakBotDetectShowRad:GetInt() > 0 then
  300.                 for i = 1, 6 do
  301.                     local o = ( v + Vector( math.sin( i * 1 ) * RakBotDetectThreshold:GetInt(), math.cos( i * 1 ) * RakBotDetectThreshold:GetInt(), 0 ) ):ToScreen()
  302.                     local o2 = ( v + Vector( math.sin( ( i + 1 ) * 1 ) * RakBotDetectThreshold:GetInt(), math.cos( ( i + 1 ) * 1 ) * RakBotDetectThreshold:GetInt(), 0 ) ):ToScreen()
  303.                    
  304.                     surface.SetDrawColor( 255, 0, 0, 255 )
  305.                     surface.DrawLine( o.x, o.y, o2.x, o2.y )
  306.                 end
  307.             end
  308.         end
  309.     end
  310. end
  311. hook.Add( "HUDPaint", "RakBot", RakBotDraw )
  312.  
  313. local function RakBotThink()
  314.     if RakBotLight then
  315.         local light = DynamicLight( LocalPlayer():UserID() )
  316.         if light then
  317.             light.Pos = LocalPlayer():GetEyeTrace().HitPos
  318.             light.r = 255
  319.             light.g = 255
  320.             light.b = 255
  321.             light.Brightness = 10
  322.             light.Size = 800
  323.             light.Decay = 0
  324.             light.DieTime = CurTime() + 0.2
  325.         end
  326.     end
  327.     if RakBotAura then
  328.         local light = DynamicLight( LocalPlayer():UserID() )
  329.         if light then
  330.             light.Pos = LocalPlayer():GetPos()
  331.             light.r = 255
  332.             light.g = 255
  333.             light.b = 255
  334.             light.Brightness = 10
  335.             light.Size = 800
  336.             light.Decay = 0
  337.             light.DieTime = CurTime() + 0.2
  338.         end
  339.     end
  340.     for k, v in pairs( RakBotDetects ) do
  341.         for b, n in pairs( player.GetAll() ) do
  342.             if RakBotDetectTrace:GetInt() > 0 then
  343.                 if n:GetPos():Distance( v ) < RakBotDetectThreshold:GetInt() and !util.TraceLine( { start = v + Vector( 0, 0, 5 ), endpos = n:GetPos() } ).Hit and RakBotDetected[ n:UniqueID() ] ~= true then
  344.                     chat.AddText( "Detector " .. k .. " breached by " .. n:Nick() )
  345.                     RakBotDetected[ n:UniqueID() ] = true
  346.                 elseif n:GetPos():Distance( v ) > RakBotDetectThreshold:GetInt() then
  347.                     RakBotDetected[ n:UniqueID() ] = false
  348.                 end
  349.             else
  350.                 if n:GetPos():Distance( v ) < RakBotDetectThreshold:GetInt() and RakBotDetected[ n:UniqueID() ] ~= true then
  351.                     chat.AddText( "Detector " .. k .. " breached by " .. n:Nick() )
  352.                     RakBotDetected[ n:UniqueID() ] = true
  353.                 elseif n:GetPos():Distance( v ) > RakBotDetectThreshold:GetInt() then
  354.                     RakBotDetected[ n:UniqueID() ] = false
  355.                 end
  356.             end
  357.         end
  358.     end
  359. end
  360. hook.Add( "Think", "RakBot", RakBotThink )
  361.  
  362. concommand.Add( "rak_bot_light", function() RakBotLight = !RakBotLight end )
  363. concommand.Add( "rak_bot_aura", function() RakBotAura = !RakBotAura end )
  364.  
  365. local function RakBotDetectAdd()
  366.     table.insert( RakBotDetects, LocalPlayer():GetPos() )
  367.     chat.AddText( "Detector " .. #RakBotDetects .. " placed" )
  368. end
  369.  
  370. local function RakBotDetectRemove()
  371.     if #RakBotDetects > 0 then
  372.         local best = 99999
  373.         local var = 0
  374.         for k, v in pairs( RakBotDetects ) do
  375.             if v:Distance( LocalPlayer():GetPos() ) < best then
  376.                 best = v:Distance( LocalPlayer():GetPos() )
  377.                 var = k
  378.             end
  379.         end
  380.         table.remove( RakBotDetects, var )
  381.         chat.AddText( "Detector " .. var .. " removed" )
  382.     end
  383. end
  384.  
  385. concommand.Add( "rak_bot_detectadd", RakBotDetectAdd )
  386. concommand.Add( "rak_bot_detectremove", RakBotDetectRemove )
  387.  
  388.  
  389. -- VOTE
  390.  
  391. local function RakBotVoteChat( ply, text, tchat, dead )
  392.     if ply ~= LocalPlayer() and ply:EntIndex() ~= 0 and RakBotVoteType ~= 0 then
  393.         if !table.HasValue( RakBotVoteVoted, ply ) then
  394.             if RakBotVoteType == 1 then
  395.                 if string.find( string.lower( text ), "!yes" ) then
  396.                     table.insert( RakBotVoteVoted, ply )
  397.                     RakBotVoteVotes[ "yes" ] = RakBotVoteVotes[ "yes" ] + 1
  398.                     RakBotSay( "Player " .. ply:Nick() .. " voted for. (+" .. RakBotVoteVotes[ "yes" ] .. "/-" .. RakBotVoteVotes[ "no" ] .. ")" )
  399.                 elseif string.find( string.lower( text ), "!no" ) then
  400.                     table.insert( RakBotVoteVoted, ply )
  401.                     RakBotVoteVotes[ "no" ] = RakBotVoteVotes[ "no" ] + 1
  402.                     RakBotSay( "Player " .. ply:Nick() .. " voted against. (+" .. RakBotVoteVotes[ "yes" ] .. "/-" .. RakBotVoteVotes[ "no" ] .. ")" )
  403.                 end
  404.             end
  405.             if RakBotVoteType == 2 then
  406.                 if string.find( text, "!" ) then
  407.                     for k, v in pairs( RakBotVoteVotes ) do
  408.                         if string.lower( string.sub( text, string.find( text, "!" ) + 1 ) ) == string.lower( k ) then
  409.                             table.insert( RakBotVoteVoted, ply )
  410.                             RakBotVoteVotes[ string.lower( string.sub( text, string.find( text, "!" ) + 1 ) ) ] = v + 1
  411.                             RakBotSay( "Player " .. ply:Nick() .. " voted for " .. k .. " with " .. v .. " other(s)." )
  412.                             return
  413.                         end
  414.                     end
  415.                     table.insert( RakBotVoteVoted, ply )
  416.                     RakBotVoteVotes[ string.sub( text, string.find( text, "!" ) + 1 ) ] = 1
  417.                     RakBotSay( "Player " .. ply:Nick() .. " voted for " .. string.sub( text, string.find( text, "!" ) + 1 ) .. "." )
  418.                 end
  419.             end
  420.         end
  421.     end
  422.     if ply == LocalPlayer() then
  423.         RakBotSayDelay = RakBotSayDelay + 1
  424.         timer.Simple( 2, function() RakBotSayDelay = RakBotSayDelay - 1 end )
  425.     end
  426.    
  427.     -- CHAT NOMMERS
  428.    
  429.     if RakBotReverseChat:GetInt() > 0 and ply ~= LocalPlayer() then
  430.         RakBotSay( string.reverse( text ) )
  431.     end
  432.    
  433.     if RakBotByteChat:GetInt() > 0 and ply~= LocalPlayer() then
  434.         local said = {}
  435.         for _, k in pairs( string.ToTable( text ) ) do
  436.             table.insert( said, string.byte( k ) )
  437.         end
  438.         RakBotSay( table.concat( said, " " ) )
  439.     end
  440.    
  441.     if RakBotCambChat:GetInt() > 0 and ply ~= LocalPlayer() then
  442.         local tosay = ""
  443.         for k, v in pairs( string.Explode( " ", text ) ) do
  444.             if string.len( v ) > 1 then
  445.                 local word = string.sub( v, 2, string.len( v ) - 1 )
  446.                 word = string.ToTable( word )
  447.                 table.sort( word, function( a, b ) return ( math.random( 0, 1 ) == 0 ) end )
  448.                 word = table.concat( word, "" )
  449.                 tosay = tosay .. string.Left( v, 1 ) .. word .. string.Right( v, 1 ) .. " "
  450.             else
  451.                 tosay = tosay .. v .. " "
  452.             end
  453.         end
  454.         RakBotSay( string.Left( tosay, string.len( tosay ) - 1 ) )
  455.     end
  456. end
  457. hook.Add( "OnPlayerChat", "RakBot", RakBotVoteChat )
  458.  
  459. local function RakBotVoteStartYN( ply, com, args )
  460.     if RakBotVoteType ~= 0 then
  461.         RakBotVoteStop()
  462.     end
  463.     RakBotVoteType = 1
  464.     RakBotSay( "RakBot: \"" .. ( args[1] or "VOTE" ) .. "\". Vote with !yes or !no" )
  465.     RakBotVoteVotes[ "yes" ] = 0
  466.     RakBotVoteVotes[ "no" ] = 0
  467.     timer.Create( "RakBotVote", RakBotVoteTime:GetInt(), 1, RunConsoleCommand, "rak_bot_votestop" )
  468. end
  469.  
  470. local function RakBotVoteStartOpen( ply, com, args )
  471.     if RakBotVoteType ~= 0 then
  472.         RakBotVoteStop()
  473.     end
  474.     RakBotVoteType = 2
  475.     RakBotSay( "RakBot: \"" .. ( args[1] or "VOTE" ) .. "\". Vote with ! then what you want to vote." )
  476.     timer.Create( "RakBotVote", RakBotVoteTime:GetInt(), 1, RunConsoleCommand, "rak_bot_votestop" )
  477. end
  478.  
  479. local function RakBotVoteStop()
  480.     if timer.Exists( "RakBotVote" ) then
  481.         timer.Stop( "RakBotVote" )
  482.     end
  483.    
  484.     RakBotSay( "Vote Over. Results:" )
  485.    
  486.     if RakBotVoteType == 1 then
  487.         local extra = ""
  488.         if RakBotVoteVotes[ "yes" ] > RakBotVoteVotes[ "no" ] then
  489.             extra = "Vote Passed."
  490.         elseif RakBotVoteVotes[ "yes" ] < RakBotVoteVotes[ "no" ] then
  491.             extra = "Vote Failed."
  492.         elseif RakBotVoteVotes[ "yes" ] + RakBotVoteVotes[ "no" ] == 0 then
  493.             extra = "Nobody Voted."
  494.         elseif RakBotVoteVotes[ "yes" ] == RakBotVoteVotes[ "no" ] then
  495.             extra = "Vote Undecided."
  496.         else
  497.             extra = "LOLWAT GLITCH"
  498.         end
  499.        
  500.         RakBotSay( "+" .. RakBotVoteVotes[ "yes" ] .. " -" .. RakBotVoteVotes[ "no" ] .. " " .. extra )
  501.     end
  502.     if RakBotVoteType == 2 then
  503.         --if #RakBotVoteVotes == 0 then
  504.         --  RakBotSay( "Nobody Voted." )
  505.         --end
  506.             local bestnum = 0
  507.             for k, v in pairs( RakBotVoteVotes ) do
  508.                 if v > bestnum then
  509.                     bestnum = v
  510.                 end
  511.             end
  512.             local best = {}
  513.             for k, v in pairs( RakBotVoteVotes ) do
  514.                 if v == bestnum then
  515.                     table.insert( best, k )
  516.                 end
  517.             end
  518.            
  519.             RakBotSay( table.concat( best, ", " ) .. " had the most votes with " .. bestnum )
  520.         --end
  521.     end
  522.    
  523.     RakBotVoteType = 0
  524.     RakBotVoteVotes = {}
  525.     RakBotVoteVoted = {}
  526. end
  527.  
  528. concommand.Add( "rak_bot_votestartyn", RakBotVoteStartYN )
  529. concommand.Add( "rak_bot_votestartopen", RakBotVoteStartOpen )
  530.  
  531. concommand.Add( "rak_bot_votestop", RakBotVoteStop )
  532.  
  533. -- XRAY
  534.  
  535. concommand.Add( "rak_bot_xraay", function()
  536.     if !RakBotXRay then
  537.         surface.PlaySound("beep_synthtone01.wav") -- Alright, i'll show you where the sounds are.
  538.         for _, v in pairs( ents.GetAll() ) do
  539.             local r, g, b, a = v:GetColor()
  540.             RakBotXRayColors[ v:EntIndex() ] = Color( r, g, b, a )
  541.             RakBotXRayMats[ v:EntIndex() ] = v:GetMaterial()
  542.             if v:IsNPC() then
  543.                 v:SetColor( 0, 0, 255, 255 )
  544.             elseif v:IsWeapon() then
  545.                 v:SetColor( 150, 0, 255, 255 )
  546.             elseif string.find( v:GetClass(), "ghost" ) then
  547.                 v:SetColor( 255, 255, 255, 100 )
  548.             elseif v:GetClass() == "drug_lab" or v:GetClass() == "money_printer" then
  549.                 v:SetColor( 250, 50, 100, 50 )
  550.             elseif v:GetClass() == "viewmodel" then
  551.                 v:SetColor( 50, 50, 250, 50 )
  552.             else
  553.                 v:SetColor( 250, 250, 50, 100 )
  554.             end
  555.             v:SetMaterial( RakBotXRayMat:GetString() )
  556.         end
  557.         RakBotXRay = true
  558.     else
  559.         for _, v in pairs( ents.GetAll() ) do
  560.             local col = RakBotXRayColors[ v:EntIndex() ] or Color( 255, 255, 255, 255 )
  561.             v:SetMaterial( RakBotXRayMats[ v:EntIndex() ] )
  562.             v:SetColor( col.r, col.g, col.b, col.a )
  563.             RakBotXRay = false
  564.         end
  565.     end
  566.     if RakBotXRay then
  567.         surface.PlaySound("beep_error01.wav") -- When you turn it off, it will play this.
  568.     end
  569. end )
  570.  
  571. local function RakBotRenderScene()
  572.     if RakBotXRay == false then return end
  573.     for _, v in pairs( ents.FindByClass( "prop_physics" ) ) do
  574.         if IsValid( v ) then
  575.             v:SetColor( 255, 61, 190, 155 )-- <------ Change that color if you like too.
  576.             v:SetMaterial( RakBotXRayMat:GetString() )
  577.         end
  578.        
  579.     end
  580.     for _, v in pairs( player.GetAll() ) do
  581.         if IsValid( v ) then
  582.             v:SetColor( 0, 255, 76, 255 )
  583.             v:SetMaterial( RakBotXRayMat:GetString() )
  584.         end
  585.     end
  586. end
  587. hook.Add( "RenderScene", "RakBot", RakBotRenderScene )
  588. -- You didn't put the other player color ? Like, admin and all ? I'll do it
  589.  
  590. -- RANDOM COMMANDS
  591.  
  592. concommand.Add( "rak_bot_rotate1", function()
  593.     LocalPlayer():SetEyeAngles( LocalPlayer():EyeAngles() + Angle( 0, 180, 0 ) )
  594. end )
  595.  
  596. concommand.Add( "rak_bot_rotate2", function()
  597.     LocalPlayer():SetEyeAngles( LocalPlayer():EyeAngles() + Angle( -2 * LocalPlayer():EyeAngles().p, 180, 0 ) )
  598.     RunConsoleCommand( "+jump" )
  599.    
  600.     local jump =     function()
  601.             RunConsoleCommand("-jump")
  602.         end
  603.  
  604.     timer.Simple( 0.2, jump )
  605. end )
  606.  
  607. concommand.Add( "rak_bot_rotate3", function()
  608.     RunConsoleCommand( "gm_spawn", "models/props_junk/sawblade001a.mdl" )
  609.     RunConsoleCommand( "+attack" )
  610.     timer.Simple( 0.1, function()
  611.         LocalPlayer():SetEyeAngles( LocalPlayer():EyeAngles() + Angle( -2 * LocalPlayer():EyeAngles().p, 180, 0 ) )
  612.         RunConsoleCommand( "+jump" )
  613.         local jump =     function()
  614.             RunConsoleCommand("-jump")
  615.         end
  616.  
  617.     timer.Simple( 0.1, jump )
  618.         timer.Simple( 0.1, function()
  619.             RunConsoleCommand( "gmod_undo" )
  620.             RunConsoleCommand( "-attack" )
  621.         end )
  622.     end )
  623. end )
  624.  
  625. concommand.Add( "rak_bot_togglecommand", function( ply, com, args )
  626.     if !args[1] then print( "No argument specified. Use attack instead of +attack." ) end
  627.     if !RakBotToggleCommands[ args[1] ] then RakBotToggleCommands[ args[1] ] = false end
  628.     if !RakBotToggleCommands[ args[1] ] then
  629.         RunConsoleCommand( "+" .. args[1] )
  630.     else
  631.         RunConsoleCommand( "-" .. args[1] )
  632.     end
  633.     RakBotToggleCommands[ args[1] ] = !RakBotToggleCommands[ args[1] ]
  634. end )
  635.  
  636. -- MENU
  637.  
  638. local RakBotMenuFrame
  639. local function RakBotMenu()
  640.     gui.EnableScreenClicker( true )
  641.    
  642.     if !RakBotMenuFrame then
  643.         RakBotMenuFrame = vgui.Create( "DFrame" )
  644.         RakBotMenuFrame:SetSize( 300, 400 )
  645.         RakBotMenuFrame:Center()
  646.         RakBotMenuFrame:ShowCloseButton( false )
  647.         RakBotMenuFrame:SetDraggable( false )
  648.         RakBotMenuFrame:SetTitle( "" )
  649.         RakBotMenuFrame.Paint = function() end
  650.        
  651.         local Sheet = vgui.Create( "DPropertySheet", RakBotMenuFrame )
  652.         Sheet:SetPos( 0, 0 )
  653.         Sheet:SetSize( 300, 400 )
  654.        
  655.         -- RakBot Config
  656.        
  657.         local Tab = vgui.Create( "DPanelList" )
  658.         Tab:SetSpacing( 5 )
  659.         Tab:SetPadding( 5 )
  660.        
  661.         local Control = vgui.Create( "DCheckBoxLabel" )
  662.         Control:SetText( "Enabled" )
  663.         Control:SetConVar( "rak_bot_on" )
  664.         Tab:AddItem( Control )
  665.        
  666.         local Control = vgui.Create( "DCheckBoxLabel" )
  667.         Control:SetText( "Show Health" )
  668.         Control:SetConVar( "rak_bot_health" )
  669.         Tab:AddItem( Control )
  670.        
  671.         local Control = vgui.Create( "DCheckBoxLabel" )
  672.         Control:SetText( "Show Weapon" )
  673.         Control:SetConVar( "rak_bot_weapon" )
  674.         Tab:AddItem( Control )
  675.        
  676.         local Control = vgui.Create( "DCheckBoxLabel" )
  677.         Control:SetText( "Show Distance" )
  678.         Control:SetConVar( "rak_bot_distance" )
  679.         Tab:AddItem( Control )
  680.        
  681.         local Control = vgui.Create( "DCheckBoxLabel" )
  682.         Control:SetText( "Show Money" )
  683.         Control:SetConVar( "rak_bot_money" )
  684.         Tab:AddItem( Control )
  685.        
  686.         local Control = vgui.Create( "DCheckBoxLabel" )
  687.         Control:SetText( "Show Health" )
  688.         Control:SetConVar( "rak_bot_health" )
  689.         Tab:AddItem( Control )
  690.        
  691.         local Objects = vgui.Create( "DListView" )
  692.         Objects:AddColumn( "Targets" )
  693.         Objects:SetSize( 50, 100 )
  694.         Objects:SetMultiSelect( false )
  695.         function Objects:OnClickLine( line )
  696.             line:SetSelected( true )
  697.             for k, v in pairs( RakBotObjects ) do
  698.                 if v == line:GetValue( 1 ) then
  699.                     table.remove( RakBotObjects, k )
  700.                 end
  701.             end
  702.             RunConsoleCommand( "rak_bot_objects", table.concat( RakBotObjects, "|" ) )
  703.             print( Objects:GetSelectedLine() )
  704.             Objects:RemoveLine( Objects:GetSelectedLine() )
  705.         end
  706.         Tab:AddItem( Objects )
  707.        
  708.         for _, v in pairs( RakBotObjects ) do
  709.             if v ~= "" then
  710.                 Objects:AddLine( v )
  711.             end
  712.         end
  713.        
  714.         local Control = vgui.Create( "DButton" )
  715.         Control:SetText( "Add" )
  716.         Control.DoClick = function()
  717.             Derma_StringRequest( "RakBot", "Name of entity to add:", "", function( txt )
  718.                 table.insert( RakBotObjects, txt )
  719.                 RunConsoleCommand( "rak_bot_objects", table.concat( RakBotObjects, "|" ) )
  720.                 Objects:AddLine( txt )
  721.             end )
  722.         end
  723.         Tab:AddItem( Control )
  724.        
  725.         local Control = vgui.Create( "DButton" )
  726.         Control:SetText( "Add Looking at" )
  727.         Control.DoClick = function()
  728.             if LocalPlayer():GetEyeTrace().Hit and LocalPlayer():GetEyeTrace().Entity:IsValid() then
  729.                 table.insert( RakBotObjects, LocalPlayer():GetEyeTrace().Entity:GetClass() )
  730.                 RunConsoleCommand( "rak_bot_objects", table.concat( RakBotObjects, "|" ) )
  731.                 Objects:AddLine( LocalPlayer():GetEyeTrace().Entity:GetClass() )
  732.             end
  733.         end
  734.         Tab:AddItem( Control )
  735.        
  736.         local Control = vgui.Create( "DButton" )
  737.         Control:SetText( "Remove All" )
  738.         Control.DoClick = function()
  739.             Derma_Query( "Do you want to remove all Entites?", "RakBot",
  740.                 "Yes", function()
  741.                     for i, v in pairs( string.Explode( "|", RakBotObjects:GetString() ) ) do
  742.                         Objects:RemoveLine( i )
  743.                     end
  744.                     RakBotObjects = {}
  745.                     RunConsoleCommand( "rak_bot_objects", "" )
  746.                 end,
  747.                 "No", function() end )
  748.         end
  749.         Tab:AddItem( Control )
  750.        
  751.         local Control = vgui.Create( "DCheckBoxLabel" )
  752.         Control:SetText( "Aimdots" )
  753.         Control:SetConVar( "rak_bot_aimdot" )
  754.         Tab:AddItem( Control )
  755.        
  756.         local Control = vgui.Create( "DCheckBoxLabel" )
  757.         Control:SetText( "Aimdot Filtering" )
  758.         Control:SetConVar( "rak_bot_aimdotfilter" )
  759.         Tab:AddItem( Control )
  760.        
  761.         Sheet:AddSheet( "RakBot", Tab, "icon16/group.png", false, false, "RakBot Configuration" )
  762.        
  763.         -- Mirror Config
  764.        
  765.         local Tab = vgui.Create( "DPanelList" )
  766.         Tab:SetSpacing( 5 )
  767.         Tab:SetPadding( 5 )
  768.        
  769.         local Control = vgui.Create( "DCheckBoxLabel" )
  770.         Control:SetText( "Mirror Enabled" )
  771.         Control:SetConVar( "rak_bot_mirror" )
  772.         Tab:AddItem( Control )
  773.        
  774.         local Control = vgui.Create( "DButton" )
  775.         Control:SetText( "Enable Mirror Placement" )
  776.         Control.DoClick = function()
  777.             local PlaceFrame = vgui.Create( "DFrame" )
  778.             RunConsoleCommand( "rak_bot_mirror", 0 )
  779.             PlaceFrame:SetSize( RakBotMirrorw:GetInt(), RakBotMirrorh:GetInt() )
  780.             PlaceFrame:SetPos( RakBotMirrorx:GetInt(), RakBotMirrory:GetInt() )
  781.             PlaceFrame:ShowCloseButton( false )
  782.             PlaceFrame:SetSizable( true )
  783.             PlaceFrame:SetTitle( "Move Da Mirror" )
  784.            
  785.             local PlaceButton = vgui.Create( "DButton", PlaceFrame )
  786.             PlaceButton:SetSize( 100, 40 )
  787.             PlaceButton:SetPos( 5, 30 )
  788.             PlaceButton:SetText( "Bitch Muddafuckin Stay Here" )
  789.             PlaceButton.DoClick = function()
  790.                 local x, y = PlaceFrame:GetPos()
  791.                 local w, h = PlaceFrame:GetSize()
  792.                 RunConsoleCommand( "rak_bot_mirrorx", x )
  793.                 RunConsoleCommand( "rak_bot_mirrory", y )
  794.                 RunConsoleCommand( "rak_bot_mirrorw", w )
  795.                 RunConsoleCommand( "rak_bot_mirrorh", h )
  796.                 RunConsoleCommand( "rak_bot_mirror", 1 )
  797.                 PlaceFrame:Close()
  798.             end
  799.             PlaceButton.Think = function()
  800.                 local x, y = PlaceFrame:GetPos()
  801.                 local w, h = PlaceFrame:GetSize()
  802.                 PlaceButton:SetSize( w - 10, h - 32 )
  803.                 PlaceButton:SetPos( 5, 27 )
  804.             end
  805.         end
  806.         Tab:AddItem( Control )
  807.        
  808.         local Control = vgui.Create( "DNumSlider" )
  809.         Control:SetText( "Pitch" )
  810.         Control:SetMin( -2 )
  811.         Control:SetMax( 359 )
  812.         Control:SetDecimals( 0 )
  813.         Control:SetConVar( "rak_bot_mirrorpitch" )
  814.         Tab:AddItem( Control )
  815.        
  816.         local Control = vgui.Create( "DNumSlider" )
  817.         Control:SetText( "Yaw" )
  818.         Control:SetMin( -2 )
  819.         Control:SetMax( 359 )
  820.         Control:SetDecimals( 0 )
  821.         Control:SetConVar( "rak_bot_mirroryaw" )
  822.         Tab:AddItem( Control )
  823.        
  824.         local Control = vgui.Create( "DNumSlider" )
  825.         Control:SetText( "Roll" )
  826.         Control:SetMin( -2 )
  827.         Control:SetMax( 359 )
  828.         Control:SetDecimals( 0 )
  829.         Control:SetConVar( "rak_bot_mirrorroll" )
  830.         Tab:AddItem( Control )
  831.        
  832.         local Control = vgui.Create( "DLabel" )
  833.         Control:SetText( " " )
  834.         Tab:AddItem( Control )
  835.        
  836.         local Control = vgui.Create( "DCheckBoxLabel" )
  837.         Control:SetText( "Radar Enabled" )
  838.         Control:SetConVar( "rak_bot_radar" )
  839.         Tab:AddItem( Control )
  840.        
  841.         local Control = vgui.Create( "DButton" )
  842.         Control:SetText( "Enable Radar Placement" )
  843.         Control.DoClick = function()
  844.             local PlaceFrame = vgui.Create( "DFrame" )
  845.             RunConsoleCommand( "rak_bot_radar", 0 )
  846.             PlaceFrame:SetSize( RakBotRadarw:GetInt(), RakBotRadarh:GetInt() )
  847.             PlaceFrame:SetPos( RakBotRadarx:GetInt(), RakBotRadary:GetInt() )
  848.             PlaceFrame:ShowCloseButton( false )
  849.             PlaceFrame:SetSizable( true )
  850.             PlaceFrame:SetTitle( "Radar Placement" )
  851.            
  852.             local PlaceButton = vgui.Create( "DButton", PlaceFrame )
  853.             PlaceButton:SetSize( 100, 40 )
  854.             PlaceButton:SetPos( 5, 30 )
  855.             PlaceButton:SetText( "CONFIRM" )
  856.             PlaceButton.DoClick = function()
  857.                 local x, y = PlaceFrame:GetPos()
  858.                 local w, h = PlaceFrame:GetSize()
  859.                 RunConsoleCommand( "rak_bot_radarx", x )
  860.                 RunConsoleCommand( "rak_bot_radary", y )
  861.                 RunConsoleCommand( "rak_bot_radarw", w )
  862.                 RunConsoleCommand( "rak_bot_radarh", h )
  863.                 RunConsoleCommand( "rak_bot_radar", 1 )
  864.                 PlaceFrame:Close()
  865.             end
  866.             PlaceButton.Think = function()
  867.                 local x, y = PlaceFrame:GetPos()
  868.                 local w, h = PlaceFrame:GetSize()
  869.                 PlaceButton:SetSize( w - 10, h - 32 )
  870.                 PlaceButton:SetPos( 5, 27 )
  871.             end
  872.         end
  873.         Tab:AddItem( Control )
  874.        
  875.         local Control = vgui.Create( "DNumSlider" )
  876.         Control:SetText( "FOV" )
  877.         Control:SetMin( 0 )
  878.         Control:SetMax( 3000 )
  879.         Control:SetDecimals( 0 )
  880.         Control:SetConVar( "rak_bot_radarfov" )
  881.         Tab:AddItem( Control )
  882.        
  883.         local Control = vgui.Create( "DCheckBoxLabel" )
  884.         Control:SetText( "Auto Adjust" )
  885.         Control:SetConVar( "rak_bot_radarauto" )
  886.         Tab:AddItem( Control )
  887.        
  888.         Sheet:AddSheet( "Mirror", Tab, "icon16/magnifier.png", false, false, "Mirror and Radar Configuration" )
  889.        
  890.         -- VOTE
  891.        
  892.         local Tab = vgui.Create( "DPanelList" )
  893.         Tab:SetSpacing( 5 )
  894.         Tab:SetPadding( 5 )
  895.        
  896.         local Control = vgui.Create( "DButton" )
  897.         Control:SetText( "Start Yes / No Vote" )
  898.         Control.DoClick = function()
  899.             Derma_StringRequest( "RakBot - Yes / No Vote", "Text to dispaly as vote:", "", function( txt )
  900.                 RunConsoleCommand( "rak_bot_votestartyn", txt )
  901.             end )
  902.         end
  903.         Tab:AddItem( Control )
  904.        
  905.         local Control = vgui.Create( "DButton" )
  906.         Control:SetText( "Start Open Vote" )
  907.         Control.DoClick = function()
  908.             Derma_StringRequest( "RakBot - Open Vote", "Text to dispaly as vote:", "", function( txt )
  909.                 RunConsoleCommand( "rak_bot_votestartopen", txt )
  910.             end )
  911.         end
  912.         Tab:AddItem( Control )
  913.        
  914.         local Control = vgui.Create( "DLabel" )
  915.         Control:SetText( " " )
  916.         Tab:AddItem( Control )
  917.        
  918.         local Control = vgui.Create( "DNumSlider" )
  919.         Control:SetText( "Vote Time" )
  920.         Control:SetMin( 0 )
  921.         Control:SetMax( 300 )
  922.         Control:SetDecimals( 0 )
  923.         Control:SetConVar( "rak_bot_votetime" )
  924.         Tab:AddItem( Control )
  925.        
  926.         local Control = vgui.Create( "DButton" )
  927.         Control:SetText( "Stop Vote" )
  928.         Control.DoClick = function()
  929.             RunConsoleCommand( "rak_bot_votestop" )
  930.         end
  931.         Tab:AddItem( Control )
  932.        
  933.         Sheet:AddSheet( "Vote", Tab, "icon16/sound.png", false, false, "Voting System" )
  934.        
  935.         -- HOOKS
  936.        
  937.         local Tab = vgui.Create( "DPanelList" )
  938.         Tab:SetSpacing( 5 )
  939.         Tab:SetPadding( 5 )
  940.         Tab:EnableVerticalScrollbar( true )
  941.        
  942.         local HooksTable = {}
  943.        
  944.         local function CreateHooks()
  945.        
  946.             local Var = hook.GetTable()
  947.             table.sort( Var, function( a, b ) return a < b end )
  948.            
  949.             for HookName, HookFunctions in pairs( Var ) do
  950.                 HooksTable[ HookName ] = vgui.Create( "DCollapsibleCategory" )
  951.                 HooksTable[ HookName ]:SetExpanded( 0 )
  952.                 HooksTable[ HookName ]:SetLabel( HookName )
  953.                
  954.                 HooksTable[ HookName ].Contents = vgui.Create( "DPanelList" )
  955.                 HooksTable[ HookName ].Contents:SetAutoSize( true )
  956.                 HooksTable[ HookName ].Contents:SetSpacing( 5 )
  957.                 HooksTable[ HookName ].Contents:SetPadding( 5 )
  958.                 HooksTable[ HookName ].Contents:EnableHorizontal( false )
  959.                 HooksTable[ HookName ].Contents:EnableVerticalScrollbar( true )
  960.                
  961.                 HooksTable[ HookName ]:SetContents( HooksTable[ HookName ].Contents )
  962.                
  963.                 Tab:AddItem( HooksTable[ HookName ] )
  964.                
  965.                 local Var2 = HookFunctions
  966.                 table.sort( Var2, function( a, b ) return a < b end )
  967.                
  968.                 /*
  969.                 for HookID, HookFunction in pairs( Var2 ) do
  970.                     HooksTable[ HookName ].Contents[ HookID ] = vgui.Create( "DButton" )
  971.                     HooksTable[ HookName ].Contents[ HookID ]:SetText( HookID )
  972.                     HooksTable[ HookName ].Contents[ HookID ].DoClick = function()
  973.                         local Menu = DermaMenu()
  974.                         Menu:AddOption( "Call Hook", function() hook.Call( HookName ) end )
  975.                         Menu:AddOption( "Remove Hook", function() hook.Remove( HookName, HookID ) HooksTable[ HookName ].Contents[ HookID ]:Remove() end )
  976.                         Menu:Open()
  977.                     end
  978.                     HooksTable[ HookName ].Contents:AddItem( HooksTable[ HookName ].Contents[ HookID ] )
  979.                 end
  980.                 */
  981.             end
  982.         end
  983.        
  984.         local Control = vgui.Create( "DButton" )
  985.         Control:SetText( "Refresh" )
  986.         Control.DoClick = function()
  987.             for k, v in pairs( HooksTable ) do
  988.                 v:Remove()
  989.             end
  990.             CreateHooks()
  991.         end
  992.         Tab:AddItem( Control )
  993.        
  994.         CreateHooks()
  995.        
  996.         Sheet:AddSheet( "Hooks", Tab, "icon16/anchor.png", false, false, "Manage active Lua Hooks" )
  997.        
  998.         -- OTHER
  999.        
  1000.         local Tab = vgui.Create( "DPanelList" )
  1001.         Tab:SetSpacing( 5 )
  1002.         Tab:SetPadding( 5 )
  1003.         Tab:EnableVerticalScrollbar( true )
  1004.        
  1005.         local Control = vgui.Create( "DButton" )
  1006.         Control:SetText( "Light" )
  1007.         Control.DoClick = function()
  1008.             RunConsoleCommand( "rak_bot_light" )
  1009.         end
  1010.         Tab:AddItem( Control )
  1011.        
  1012.         local Control = vgui.Create( "DButton" )
  1013.         Control:SetText( "Aura Light" )
  1014.         Control.DoClick = function()
  1015.             RunConsoleCommand( "rak_bot_aura" )
  1016.         end
  1017.         Tab:AddItem( Control )
  1018.        
  1019.         local Control = vgui.Create( "DLabel" )
  1020.         Control:SetText( " " )
  1021.         Tab:AddItem( Control )
  1022.        
  1023.         local Control = vgui.Create( "DButton" )
  1024.         Control:SetText( "Add Detector" )
  1025.         Control.DoClick = function()
  1026.             RunConsoleCommand( "rak_bot_detectadd" )
  1027.         end
  1028.         Tab:AddItem( Control )
  1029.        
  1030.         local Control = vgui.Create( "DButton" )
  1031.         Control:SetText( "Remove Detector" )
  1032.         Control.DoClick = function()
  1033.             RunConsoleCommand( "rak_bot_detectremove" )
  1034.         end
  1035.         Tab:AddItem( Control )
  1036.        
  1037.         local Control = vgui.Create( "DNumSlider" )
  1038.         Control:SetText( "Detector Threshold" )
  1039.         Control:SetMin( 0 )
  1040.         Control:SetMax( 2000 )
  1041.         Control:SetDecimals( 0 )
  1042.         Control:SetConVar( "rak_bot_detectthresh" )
  1043.         Tab:AddItem( Control )
  1044.        
  1045.         local Control = vgui.Create( "DCheckBoxLabel" )
  1046.         Control:SetText( "Show Detectors" )
  1047.         Control:SetConVar( "rak_bot_detectshow" )
  1048.         Tab:AddItem( Control )
  1049.        
  1050.         local Control = vgui.Create( "DCheckBoxLabel" )
  1051.         Control:SetText( "Show Thresholds" )
  1052.         Control:SetConVar( "rak_bot_detectshowrad" )
  1053.         Tab:AddItem( Control )
  1054.        
  1055.         local Control = vgui.Create( "DCheckBoxLabel" )
  1056.         Control:SetText( "Trace Detection" )
  1057.         Control:SetConVar( "rak_bot_detecttrace" )
  1058.         Tab:AddItem( Control )
  1059.        
  1060.         local Control = vgui.Create( "DLabel" )
  1061.         Control:SetText( " " )
  1062.         Tab:AddItem( Control )
  1063.        
  1064.         local Control = vgui.Create( "DCheckBoxLabel" )
  1065.         Control:SetText( "Reverse Chat" )
  1066.         Control:SetConVar( "rak_bot_chatreverse" )
  1067.         Tab:AddItem( Control )
  1068.        
  1069.         local Control = vgui.Create( "DCheckBoxLabel" )
  1070.         Control:SetText( "Cambridge Chat" )
  1071.         Control:SetConVar( "rak_bot_chatcambridge" )
  1072.         Tab:AddItem( Control )
  1073.        
  1074.         local Control = vgui.Create( "DLabel" )
  1075.         Control:SetText( " " )
  1076.         Tab:AddItem( Control )
  1077.        
  1078.         local Control = vgui.Create( "DButton" )
  1079.         Control:SetText( "Reload Scripts" )
  1080.         Control.DoClick = function()
  1081.             if RakBotMenuFrame then
  1082.                 RakBotMenuFrame:Close()
  1083.                 gui.EnableScreenClicker( false )
  1084.             end
  1085.             include( "autorun/client/RakBot.lua" )
  1086.         end
  1087.         Tab:AddItem( Control )
  1088.        
  1089.         Sheet:AddSheet( "Misc", Tab, "icon16/plugin.png", false, false, "Other Settings" )
  1090.     else
  1091.         RakBotMenuFrame:SetVisible( true )
  1092.     end
  1093. end
  1094.  
  1095. local function RakBotMenuOff()
  1096.     if RakBotMenuFrame then
  1097.         RakBotMenuFrame:SetVisible( false )
  1098.         gui.EnableScreenClicker( false )
  1099.     end
  1100. end
  1101.  
  1102. concommand.Add( "+rak_bot_menu", RakBotMenu )
  1103. concommand.Add( "-rak_bot_menu", RakBotMenuOff )
  1104.  
  1105. concommand.Add( "rak_bot_reload", function() include( "scripts/RakBot.lua" ) end )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement