Guest User

MadHackv5.0

a guest
Nov 17th, 2014
416
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 25.80 KB | None | 0 0
  1. --[[
  2.     M   M         A     D D      H   H     A       C C   K   K
  3.    M M M M       A A    D  D     H   H    A A     C   C  K  K
  4.   M   M   M     A A A   D   D    H H H   A A A   C       KK
  5.  M         M   A     A  D  D     H   H  A     A   C   C  K  K
  6. M           M A       A D D      H   H A       A   C C   K   K
  7. --]]
  8.  
  9. local SkelOptn = 0
  10. local PrOptn = 0
  11. local KyOptn = 0
  12. local EntOptn = 0
  13. local plyrBxOptn = 0
  14. local PlyrOptn = 0
  15. local SPOptn = 0
  16. local MDOptn = 0
  17. local SSCOptn = 0
  18. local CROptn = 0
  19.  
  20. function MadMenu ( )
  21. local DermaPanel = vgui.Create( "DFrame" )
  22.    DermaPanel:SetPos( 50,50 )
  23.    DermaPanel:SetSize( 200, 250 )
  24.    DermaPanel:SetTitle( "MadHack Menu" )
  25.    DermaPanel:SetVisible( true )
  26.    DermaPanel:SetDraggable( true )
  27.    DermaPanel:ShowCloseButton( true )
  28.    DermaPanel:MakePopup()
  29.  
  30. local PropertySheet = vgui.Create( "DPropertySheet" )
  31. PropertySheet:SetParent( DermaPanel )
  32. PropertySheet:SetPos( 5, 30 )
  33. PropertySheet:SetSize( 180, 210 )
  34.  
  35. local SheetItemPanel = vgui.Create( "DPanel", DermaPanel )
  36. SheetItemPanel:SetPos( 25, 50 )
  37. SheetItemPanel:SizeToContents()
  38. SheetItemPanel.Paint = function()
  39.     surface.SetDrawColor( 50, 50, 50, 255 )
  40.     surface.DrawRect( 0, 0, SheetItemPanel:GetWide(), SheetItemPanel:GetTall() )
  41. end
  42.  
  43. local AIMKBTN = vgui.Create( "DButton", SheetItemPanel )
  44. local PRECBTN = vgui.Create( "DButton", SheetItemPanel )
  45. local SheetItemone = vgui.Create( "DButton", SheetItemPanel )
  46.    SheetItemone:SetText( "Turn Off" )
  47.    SheetItemone:SetPos( 20, 20 )
  48.    SheetItemone:SetSize( 120, 20 )
  49.    SheetItemone.DoClick = function ()
  50.     RunConsoleCommand( "-KeyAimbot" )
  51.     KyOptn = (0)
  52.     AIMKBTN:SetText( "Aim On Key : Off" )
  53.     RunConsoleCommand( "-PrecisionAimbot" )
  54.     PrOptn = (0)
  55.     PRECBTN:SetText( "Precision : Off" )
  56.   end
  57.    
  58. //local PRECBTN = vgui.Create( "DButton", SheetItemPanel )
  59.    if ( PrOptn == 0 ) then
  60.     PRECBTN:SetText( "Precision : Off" )
  61.    else
  62.     PRECBTN:SetText( "Precision : On" )
  63.    end
  64.    PRECBTN:SetPos( 20, 50 )
  65.    PRECBTN:SetSize( 120, 20 )
  66.    PRECBTN.DoClick = function ()
  67.    if ( PrOptn == 0 ) then
  68.     RunConsoleCommand( "+PrecisionAimbot" )
  69.     PRECBTN:SetText( "Precision : On" )
  70.     else
  71.     RunConsoleCommand( "-PrecisionAimbot" )
  72.     PRECBTN:SetText( "Precision : Off" )
  73.     end
  74.   end
  75.  
  76. //local AIMKBTN = vgui.Create( "DButton", SheetItemPanel )  
  77.    if ( KyOptn == 0 ) then
  78.    AIMKBTN:SetText( "Aim On Key : Off" )
  79.    else
  80.    AIMKBTN:SetText( "Aim On Key : On" )
  81.    end
  82.    AIMKBTN:SetPos( 20, 80 )
  83.    AIMKBTN:SetSize( 120, 20 )
  84.    AIMKBTN.DoClick = function ()
  85.    if ( KyOptn == 0 ) then
  86.     RunConsoleCommand( "+KeyAimbot" )  
  87.     AIMKBTN:SetText( "Aim On Key : On" )
  88.     else
  89.     RunConsoleCommand( "-KeyAimbot" )
  90.     AIMKBTN:SetText( "Aim On Key : Off" )
  91.     end
  92.   end
  93.  
  94. local SheetItemPaneltwo = vgui.Create( "DPanel", DermaPanel )
  95. SheetItemPaneltwo:SetPos( 25, 50 )
  96. SheetItemPaneltwo:SizeToContents()
  97. SheetItemPaneltwo.Paint = function()
  98.     surface.SetDrawColor( 50, 50, 50, 255 )
  99.     surface.DrawRect( 0, 0, SheetItemPaneltwo:GetWide(), SheetItemPaneltwo:GetTall() )
  100. end
  101.  
  102. local EntityBtn = vgui.Create( "DButton", SheetItemPaneltwo )
  103. local PlyrBtn = vgui.Create( "DButton", SheetItemPaneltwo )
  104. local PlyrNmBtn = vgui.Create( "DButton", SheetItemPaneltwo )
  105. local SkelBtn = vgui.Create( "DButton", SheetItemPaneltwo )
  106. local SheetItemtwo = vgui.Create( "DButton", SheetItemPaneltwo )
  107.    SheetItemtwo:SetText( "Turn Off" )
  108.    SheetItemtwo:SetPos( 20, 20 )
  109.    SheetItemtwo:SetSize( 120, 20 )
  110.    SheetItemtwo.DoClick = function ()
  111.     RunConsoleCommand( "-EntityESP" )
  112.     EntityBtn:SetText( "Show Entitys : Off" )
  113.     EntOptn = 0
  114.     RunConsoleCommand( "-NameESP" )
  115.     PlyrOptn = 0
  116.     PlyrNmBtn:SetText( "Show Names : Off" )
  117.     RunConsoleCommand( "-PlayerBoxESP" )
  118.     plyrBxOptn = 0
  119.     PlyrBtn:SetText( "Show Players : Off" )
  120.     RunConsoleCommand( "-SkESP" )
  121.     SkelOptn = 0
  122.     SkelBtn:SetText( "Skeleton Cham : Off" )
  123.   end
  124.    
  125.    if ( EntOptn == 0 ) then
  126.    EntityBtn:SetText( "Show Entitys : Off" )
  127.    else
  128.    EntityBtn:SetText( "Show Entitys : On" )
  129.    end
  130.    EntityBtn:SetPos( 20, 50 )
  131.    EntityBtn:SetSize( 120, 20 )
  132.    EntityBtn.DoClick = function ()
  133.      if ( EntOptn == 0 ) then
  134.     RunConsoleCommand( "+EntityESP" )
  135.     EntityBtn:SetText( "Show Entitys : On" )
  136.     else
  137.     RunConsoleCommand( "-EntityESP" )
  138.     EntityBtn:SetText( "Show Entitys : Off" )
  139.     end
  140.   end
  141.    
  142.    if ( plyrBxOptn == 0 ) then
  143.    PlyrBtn:SetText( "Show Players : Off" )
  144.    else
  145.    PlyrBtn:SetText( "Show Players : On" )
  146.    end
  147.    PlyrBtn:SetPos( 20, 80 )
  148.    PlyrBtn:SetSize( 120, 20 )
  149.    PlyrBtn.DoClick = function ()
  150.      if ( plyrBxOptn == 0 ) then
  151.     RunConsoleCommand( "+PlayerBoxESP" )
  152.     PlyrBtn:SetText( "Show Players : On" )
  153.     else
  154.     RunConsoleCommand( "-PlayerBoxESP" )
  155.     PlyrBtn:SetText( "Show Players : Off" )
  156.     end
  157.   end
  158.      
  159.    if ( PlyrOptn == 0 ) then
  160.    PlyrNmBtn:SetText( "Show Names : Off" )
  161.    else
  162.    PlyrNmBtn:SetText( "Show Names : On" )
  163.    end
  164.    PlyrNmBtn:SetPos( 20, 110 )
  165.    PlyrNmBtn:SetSize( 120, 20 )
  166.    PlyrNmBtn.DoClick = function ()
  167.     if ( PlyrOptn == 0 ) then
  168.     RunConsoleCommand( "+NameESP" )
  169.     PlyrNmBtn:SetText( "Show Names : On" )
  170.     else
  171.     RunConsoleCommand( "-NameESP" )
  172.     PlyrNmBtn:SetText( "Show Names : Off" )
  173.     end
  174.   end
  175.    
  176.    if ( SkelOptn == 0 ) then
  177.    SkelBtn:SetText( "Skeleton Cham : Off" )
  178.    else
  179.    SkelBtn:SetText( "Skeleton Cham : On" )
  180.    end
  181.    SkelBtn:SetPos( 20, 140 )
  182.    SkelBtn:SetSize( 120, 20 )
  183.    SkelBtn.DoClick = function ()
  184.     if ( SkelOptn == 0 ) then
  185.     RunConsoleCommand( "+SkESP" )
  186.     SkelBtn:SetText( "Skeleton Cham : On" )
  187.     else
  188.     RunConsoleCommand( "-SkESP" )
  189.     SkelBtn:SetText( "Skeleton Cham : Off" )
  190.     end
  191.   end
  192.  
  193. local SheetItemPanelthree = vgui.Create( "DPanel", DermaPanel )
  194. SheetItemPanelthree:SetPos( 25, 50 )
  195. SheetItemPanelthree:SizeToContents()
  196. SheetItemPanelthree.Paint = function()
  197.     surface.SetDrawColor( 50, 50, 50, 255 )
  198.     surface.DrawRect( 0, 0, SheetItemPanelthree:GetWide(), SheetItemPanelthree:GetTall() )
  199. end
  200.  
  201.  local SheetItemthree = vgui.Create( "DButton", SheetItemPanelthree )
  202.    if ( SPOptn == 0 ) then
  203.    SheetItemthree:SetText( "Spectate : Off" )
  204.    else
  205.    SheetItemthree:SetText( "Spectate : On" )
  206.    end
  207.    SheetItemthree:SetPos( 20, 20 )
  208.    SheetItemthree:SetSize( 120, 20 )
  209.    SheetItemthree.DoClick = function ()
  210.    if ( SPOptn == 0 ) then
  211.     RunConsoleCommand( "SM_toggle" )
  212.     SheetItemthree:SetText( "Spectate : On" )
  213.     else
  214.     RunConsoleCommand( "SM_toggle" )
  215.     SheetItemthree:SetText( "Spectate : Off" )
  216.     end
  217.   end
  218.  
  219.  local CRBtn = vgui.Create( "DButton", SheetItemPanelthree )
  220.    if ( CROptn == 0 ) then
  221.    CRBtn:SetText( "Laser Sight : Off" )
  222.    else
  223.    CRBtn:SetText( "Laser Sight : On" )
  224.    end
  225.    CRBtn:SetPos( 20, 50 )
  226.    CRBtn:SetSize( 120, 20 )
  227.    CRBtn.DoClick = function ()
  228.      if ( CROptn == 0 ) then
  229.     RunConsoleCommand( "+laser" )  
  230.     CRBtn:SetText( "Laser Sight : On" )
  231.     else
  232.     RunConsoleCommand( "-laser" )  
  233.     CRBtn:SetText( "Laser Sight : Off" )
  234.     end
  235.   end
  236.    
  237. local TBtn = vgui.Create( "DButton", SheetItemPanelthree )
  238.    if ( MDOptn == 0 ) then
  239.    TBtn:SetText( "Mad Vision : Off" )
  240.    else
  241.    TBtn:SetText( "Mad Vision : On" )
  242.    end
  243.    TBtn:SetPos( 20, 80 )
  244.    TBtn:SetSize( 120, 20 )
  245.    TBtn.DoClick = function ()
  246.     if ( MDOptn == 0 ) then
  247.     RunConsoleCommand( "toggle_madvision" )  
  248.     TBtn:SetText( "Mad Vision : On" )
  249.     else
  250.     RunConsoleCommand( "toggle_madvision" )  
  251.     TBtn:SetText( "Mad Vision : Off" )
  252.     end
  253.   end
  254.  
  255.   local SSCBtn = vgui.Create( "DButton", SheetItemPanelthree )
  256.    if ( SSCOptn == 0 ) then
  257.    SSCBtn:SetText( "Third Person : Off" )
  258.    else
  259.    SSCBtn:SetText( "Third Person : On" )
  260.    end
  261.    SSCBtn:SetPos( 20, 110 )  
  262.    SSCBtn:SetSize( 120, 20 )
  263.    SSCBtn.DoClick = function ()
  264.      if ( SSCOptn == 0 ) then
  265.     RunConsoleCommand( "+ThirdPerson" )  
  266.     SSCBtn:SetText( "Third Person : On" )
  267.     else
  268.     RunConsoleCommand( "-ThirdPerson" )  
  269.     SSCBtn:SetText( "Third Person : Off" )
  270.     end
  271.   end
  272.      
  273. PropertySheet:AddSheet( "Aimbot", SheetItemPanel, "gui/silkicons/user", false, false, "Aimbot" )
  274. PropertySheet:AddSheet( "ESP", SheetItemPaneltwo, "gui/silkicons/user", false, false, "ESP" )
  275. PropertySheet:AddSheet( "MISC", SheetItemPanelthree, "gui/silkicons/user", false, false, "MISC" )
  276. end
  277.  
  278. concommand.Add( "Mad_Menu", MadMenu)
  279.  
  280. local ply = LocalPlayer()
  281.  
  282. function Visible( ply )
  283.         if (!IsValid( ply )) then return false end
  284.        
  285.         local vecPos, _ = ply:GetBonePosition( ply:LookupBone( "ValveBiped.Bip01_Head1" ) or 12 );
  286.         local trace = { start = LocalPlayer():EyePos(), endpos = vecPos, filter = LocalPlayer(), mask = MASK_SHOT };
  287.         local traceRes = util.TraceLine( trace );
  288.        
  289.         TraceRes = traceRes;
  290.        
  291.         if (traceRes.HitWorld || traceRes.Entity != ply) then return false end;
  292.        
  293.         return true;
  294. end
  295.  
  296. function KeyAimBot ()
  297.                 KyOptn = (1)
  298.                 hook.Remove("Think", "Precision_Aim", function()
  299.                 hook.Add("Think", "KeyAimBot", function()
  300.                         for k,v in pairs(player.GetAll()) do
  301.                                 local position  = (v:GetPos():ToScreen())
  302.                                 if v != ply and Visible(v) and IsValid(v) and input.IsKeyDown(KEY_F) then
  303.                                         local head = v:LookupBone("ValveBiped.Bip01_Head1")
  304.                                         local headpos,headang = v:GetBonePosition(head)
  305.                                         ply:SetEyeAngles((headpos+Vector(0,0,1) - ply:GetShootPos()):Angle())
  306.                                     end
  307.                                 end
  308.                         end)
  309.                 end )
  310.         end
  311.  
  312. concommand.Add( "+KeyAimbot", KeyAimBot )
  313.  
  314. function KeyAimBotStop ()
  315.         KyOptn = (0)
  316.         hook.Remove("Think", "KeyAimBot", function()
  317.         end)
  318.     end
  319.  
  320. concommand.Add( "-KeyAimbot", KeyAimBotStop )
  321.  
  322. function PrecisionAimbot ()
  323.   PrOptn = (1)
  324.   hook.Remove("Think", "KeyAimBot", function()
  325.   hook.Add("Think", "Precision_Aim", function()
  326.         local trace = util.GetPlayerTrace( ply )
  327.         local traceRes = util.TraceLine( trace )
  328.         if traceRes.HitNonWorld then
  329.                 local target = traceRes.Entity
  330.                 if target:IsPlayer() then
  331.                         local targethead = target:LookupBone("ValveBiped.Bip01_Head1")
  332.                         local targetheadpos,targetheadang = target:GetBonePosition(targethead)
  333.                         ply:SetEyeAngles((targetheadpos - ply:GetShootPos()):Angle())
  334.                     end
  335.                  end
  336.                 end)
  337.             end)
  338.            
  339.      end
  340.  
  341. concommand.Add( "+PrecisionAimbot", PrecisionAimbot )
  342.  
  343. function PrecisionAimbotStop ()
  344. PrOptn = (0)
  345. hook.Remove("Think", "Precision_Aim", function()
  346.   end)
  347. end
  348.  
  349. concommand.Add( "-PrecisionAimbot", PrecisionAimbotStop )
  350.  
  351. function EntityESP ()
  352.   EntOptn = (1)
  353.   local g=table.Copy(_G)
  354.   local r,iss,isn,ist,isf,isn,isp,ise=debug.getregistry(),function(...) local ags={...} return g.type(ags[1])=="string" end,function(...) local ags={...} return g.type(ags[1])=="number" end,function(...) local ags={...} return g.type(ags[1])=="table" end,function(...) local ags={...} return g.type(ags[1])=="function" end,function(...) local ags={...} if(ags[1]==nil) then return true end local d=ags[2] and ags[2].."/"..ags[1] or ags[1] return g.type(ags[1])=="nil", frn.Delete(d) end,function(...) local ags={...} local d=ags[1] and ags[1].."\47\42" or "\42" return {frn.Find(d,"\68\65\84\65")},g.type(ags[1])=="Player" end, function(...) local ags={...} return g.type(ags[1])=="Entity" end; frn=g['input']; fm=g['hook']; frn = g['file']; frc=g['cvars'];
  355.   surface.CreateFont("DefaultSmallDropShadow",{font="Tahoma",size=16,weight=500,shadow=true}) local callerFunc
  356.   local boxcolor_PL=Color(0,255,0,255)
  357.   local boxcolor_ENT=Color(255,255,0,255)
  358.   local function gameESP(self,plys,entts,data)
  359.   data = data or nil
  360.   for i,ent in pairs(entts) do
  361.   if iss(ent) then
  362.   ent=data!=nil and data.."/"..ent or ent // bad entity !
  363.   local ispl = isp(ent);
  364.   if( ispl ) then
  365.   self(self,ispl[1],ispl[2],ent)
  366.   end
  367.   continue;
  368.   end
  369.   if ent and IsValid(ent) and ent:GetMoveType()!=0 and ent:IsPlayer()==false then
  370.   nom=ent:GetPos()
  371.   mon=nom+Vector(0,0,ent:OBBMaxs().z)
  372.   bot=nom:ToScreen()
  373.   top=mon:ToScreen()
  374.   h=(bot.y-top.y)
  375.   w=h
  376.   surface.SetDrawColor(boxcolor_ENT)
  377.   surface.DrawOutlinedRect(top.x-w/2,top.y,w,h)
  378.   draw.DrawText(ent:GetClass(),"DefaultSmallDropShadow",top.x,top.y-20,boxcolor_ENT,TEXT_ALIGN_CENTER)
  379.   end
  380.   end
  381.   end
  382.   callerFunc=function(p,e) return true, gameESP(gameESP,p,e,nil) end
  383.   local function testesp()
  384.   if( callerFunc(isp()[1],isp()[2]) ) then
  385.   return true;
  386.   end
  387.   return false;
  388.   end
  389.   local EspShouldDraw=testesp();
  390.   local function espfunc()
  391.   if(EspShouldDraw==false) then return end
  392.   callerFunc(player.GetAll(),ents.GetAll())
  393.   end
  394.   hook.Add("HUDPaint","EspHax",espfunc)
  395.   end
  396.  
  397.   concommand.Add( "+EntityESP", EntityESP )
  398.  
  399.   function EntityESPStop ()
  400.         EntOptn = (0)
  401.         hook.Remove("HUDPaint","EspHax",espfunc)
  402.         end
  403.  
  404. concommand.Add( "-EntityESP", EntityESPStop )
  405.  
  406. function PlayerNameESP ()
  407. PlyrOptn = (1)
  408.  
  409. hook.Add( "HUDPaint", "NameESP", function()
  410.  
  411.     for k,v in pairs ( player.GetAll() ) do
  412.  
  413.         local Position = ( v:GetPos() + Vector( 0,0,80 ) ):ToScreen()
  414.         local Name = ""
  415.  
  416.         if v == LocalPlayer() then Name = "" else Name = v:Name() end
  417.  
  418.         draw.DrawText( Name, "Default", Position.x, Position.y, Color( 255, 255, 255, 255 ), 1 )
  419.        
  420.  
  421.       end
  422.     end )
  423.   end
  424.  
  425. concommand.Add( "+NameESP", PlayerNameESP )
  426.  
  427. function StopPlayerNameESP ()
  428. PlyrOptn = (0)
  429.  
  430.   hook.Remove( "HUDPaint", "NameESP", function()
  431.  
  432.   end)
  433. end  
  434.  
  435. concommand.Add( "-NameESP", StopPlayerNameESP )
  436.  
  437. local skeleton = {
  438.         { S = "ValveBiped.Bip01_Head1", E = "ValveBiped.Bip01_Neck1" },
  439.         { S = "ValveBiped.Bip01_Neck1", E = "ValveBiped.Bip01_Spine4" },
  440.         { S = "ValveBiped.Bip01_Spine4", E = "ValveBiped.Bip01_Spine2" },
  441.         { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_Spine1" },
  442.         { S = "ValveBiped.Bip01_Spine1", E = "ValveBiped.Bip01_Spine" },
  443.         { S = "ValveBiped.Bip01_Spine", E = "ValveBiped.Bip01_Pelvis" },
  444.  
  445.         { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_L_UpperArm" },
  446.         { S = "ValveBiped.Bip01_L_UpperArm", E = "ValveBiped.Bip01_L_Forearm" },
  447.         { S = "ValveBiped.Bip01_L_Forearm", E = "ValveBiped.Bip01_L_Hand" },
  448.  
  449.         { S = "ValveBiped.Bip01_Spine2", E = "ValveBiped.Bip01_R_UpperArm" },
  450.         { S = "ValveBiped.Bip01_R_UpperArm", E = "ValveBiped.Bip01_R_Forearm" },
  451.         { S = "ValveBiped.Bip01_R_Forearm", E = "ValveBiped.Bip01_R_Hand" },
  452.  
  453.         { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_L_Thigh" },
  454.         { S = "ValveBiped.Bip01_L_Thigh", E = "ValveBiped.Bip01_L_Calf" },
  455.         { S = "ValveBiped.Bip01_L_Calf", E = "ValveBiped.Bip01_L_Foot" },
  456.         { S = "ValveBiped.Bip01_L_Foot", E = "ValveBiped.Bip01_L_Toe0" },
  457.        
  458.         { S = "ValveBiped.Bip01_Pelvis", E = "ValveBiped.Bip01_R_Thigh" },
  459.         { S = "ValveBiped.Bip01_R_Thigh", E = "ValveBiped.Bip01_R_Calf" },
  460.         { S = "ValveBiped.Bip01_R_Calf", E = "ValveBiped.Bip01_R_Foot" },
  461.         { S = "ValveBiped.Bip01_R_Foot", E = "ValveBiped.Bip01_R_Toe0" },
  462. }
  463.    
  464. function Skeleton(ply)
  465. SkelOptn = (1)
  466.      if !ply:Alive() then return end
  467.      for k, v in pairs( skeleton ) do
  468.                 local sPos, ePos = ply:GetBonePosition( ply:LookupBone( v.S ) ):ToScreen(), ply:GetBonePosition( ply:LookupBone( v.E ) ):ToScreen()            
  469.                 surface.SetDrawColor( team.GetColor( ply:Team() ) )
  470.                 surface.DrawLine( sPos.x, sPos.y, ePos.x, ePos.y )
  471.                 end
  472. hook.Add("HUDPaint", "SkeletonESP", function()
  473.         for k,v in pairs(player.GetAll()) do
  474.             if v != LocalPlayer() and !IsValid(v) and !Visible(v) then
  475.                        Skeleton(v)
  476.             end
  477.          end   
  478.       end )
  479.    end
  480.  
  481. concommand.Add( "+SkESP", Skeleton)
  482.  
  483. function SkeletonStop ()
  484. SkelOptn = (0)
  485. hook.Remove ("HUDPaint", "SkeletonESP", function()
  486.   end)
  487. end  
  488.  
  489. concommand.Add( "-SkESP", SkeletonStop)
  490.  
  491. local rotation_vectors =
  492. {
  493.         Vector( 1,      1,      1 ),
  494.         Vector( -1, 1,  1 ),
  495.         Vector( 1,      -1, 1 ),
  496.         Vector( -1, -1, 1 )
  497. }
  498. function PlayerBoxESP ()
  499. plyrBxOptn = (1)
  500. hook.Add( 'HUDPaint', 'PlayerBoxESP', function()
  501.         surface.SetDrawColor( team.GetColor( ply:Team() ) )
  502.        
  503.         local w, h = ScrW(), ScrH()
  504.        
  505.         for _, e in next, player.GetAll() do
  506.                 if e != LocalPlayer() then
  507.                
  508.                 local p = e:GetPos()
  509.                 local a = e:GetAngles()
  510.                
  511.                 local mins = e:OBBMins()
  512.                 local maxs = e:OBBMaxs()
  513.                
  514.                 local left, top         = w, h
  515.                 local right, bot        = 0, 0
  516.                
  517.                 for _, v in next, rotation_vectors do
  518.                         local mins, maxs = mins, maxs
  519.                        
  520.                         mins:Rotate( a )
  521.                         maxs:Rotate( a )
  522.                        
  523.                         local s_mins = ( p + mins * v ):ToScreen()
  524.                         local s_maxs = ( p + maxs * v ):ToScreen()
  525.                        
  526.                         left    = math.min( left, math.min( s_mins.x, s_maxs.x ) )
  527.                         top             = math.min( top, math.min( s_mins.y, s_maxs.y ) )
  528.                         right   = math.max( right, math.max( s_mins.x, s_maxs.x ) )
  529.                         bot             = math.max( bot, math.max( s_mins.y, s_maxs.y ) )
  530.                 end
  531.                
  532.                 surface.DrawOutlinedRect( left, top, right - left, bot - top )
  533.         end
  534. end
  535.  
  536. end )
  537.  
  538. end
  539.  
  540. concommand.Add( "+playerBoxESP", PlayerBoxESP )
  541.  
  542. function StopPlayerBoxESP ()
  543. plyrBxOptn = (0)
  544. hook.Remove( 'HUDPaint', 'PlayerBoxESP', function()
  545.   end )
  546. end
  547.  
  548. concommand.Add( "-playerBoxESP", StopPlayerBoxESP )
  549.  
  550. local SM = {}
  551.  
  552. SM.Enabled = false
  553. SM.ViewOrigin = Vector( 0, 0, 0 )
  554. SM.ViewAngle = Angle( 0, 0, 0 )
  555. SM.Velocity = Vector( 0, 0, 0 )
  556.  
  557. function SM.CalcView( ply, origin, angles, fov )
  558.         if ( !SM.Enabled ) then return end
  559.         if ( SM.SetView ) then
  560.                 SM.ViewOrigin = origin
  561.                 SM.ViewAngle = angles
  562.                
  563.                 SM.SetView = false
  564.         end
  565.         return { origin = SM.ViewOrigin, angles = SM.ViewAngle }
  566. end
  567. hook.Add( "CalcView", "Spectator Mode", SM.CalcView )
  568.  
  569. function SM.CreateMove( cmd )
  570.         if ( !SM.Enabled ) then return end
  571.        
  572.         local time = FrameTime()
  573.         SM.ViewOrigin = SM.ViewOrigin + ( SM.Velocity * time )
  574.         SM.Velocity = SM.Velocity * 0.95
  575.        
  576.         local sensitivity = 0.022
  577.         SM.ViewAngle.p = math.Clamp( SM.ViewAngle.p + ( cmd:GetMouseY() * sensitivity ), -89, 89 )
  578.         SM.ViewAngle.y = SM.ViewAngle.y + ( cmd:GetMouseX() * -1 * sensitivity )
  579.        
  580.         local add = Vector( 0, 0, 0 )
  581.         local ang = SM.ViewAngle
  582.         if ( cmd:KeyDown( IN_FORWARD ) ) then add = add + ang:Forward() end
  583.         if ( cmd:KeyDown( IN_BACK ) ) then add = add - ang:Forward() end
  584.         if ( cmd:KeyDown( IN_MOVERIGHT ) ) then add = add + ang:Right() end
  585.         if ( cmd:KeyDown( IN_MOVELEFT ) ) then add = add - ang:Right() end
  586.         if ( cmd:KeyDown( IN_JUMP ) ) then add = add + ang:Up() end
  587.         if ( cmd:KeyDown( IN_DUCK ) ) then add = add - ang:Up() end
  588.        
  589.         add = add:GetNormal() * time * 500
  590.         if ( cmd:KeyDown( IN_SPEED ) ) then add = add * 2 end
  591.        
  592.         SM.Velocity = SM.Velocity + add
  593.        
  594.         if ( SM.LockView == true ) then
  595.                 SM.LockView = cmd:GetViewAngles()
  596.         end
  597.         if ( SM.LockView ) then
  598.                 cmd:SetViewAngles( SM.LockView )
  599.         end
  600.        
  601.         cmd:SetForwardMove( 0 )
  602.         cmd:SetSideMove( 0 )
  603.         cmd:SetUpMove( 0 )
  604. end
  605. hook.Add( "CreateMove", "Spectator Mode", SM.CreateMove )
  606.  
  607. function SM.Toggle()
  608.         if ( SPOptn == 0 ) then
  609.           SPOptn = (1)
  610.           else
  611.           SPOptn = (0)
  612.           end
  613.         SM.Enabled = !SM.Enabled
  614.         SM.LockView = SM.Enabled
  615.         SM.SetView = true
  616.        
  617.         local status = { [ true ] = "ON", [ false ] = "OFF" }
  618. end
  619. concommand.Add( "SM_toggle", SM.Toggle )
  620.  
  621. concommand.Add( "SM_pos", function() print( SM.ViewOrigin ) end )
  622.  
  623. function lasersight()  
  624.         CROptn = (1)
  625.       local vm = ply:GetViewModel()
  626.           for k,v in pairs(player.GetAll()) do
  627.             if v == ply then   
  628.                 if ply:GetViewModel() then
  629.                         local attachmentIndex = vm:LookupAttachment("1")
  630.  
  631.                         if attachmentIndex == 0 then attachmentIndex = vm:LookupAttachment("muzzle") end
  632.  
  633.                         local t = util.GetPlayerTrace(ply)
  634.                         local tr = util.TraceLine(t)
  635.                         if vm:GetAttachment(attachmentIndex) then
  636.                                 cam.Start3D(EyePos(), EyeAngles())
  637.                                         render.SetMaterial(Material("sprites/bluelaser1"))
  638.                                         render.DrawBeam(vm:GetAttachment(attachmentIndex).Pos, tr.HitPos, 6, 0, 12.5, Color(255, 0, 0, 255))                          
  639.                                         local Size = math.random() * 10
  640.                                 cam.End3D()
  641.                         end
  642.                 end
  643.             hook.Add("HUDPaint","lasersight", lasersight)  
  644.         end
  645.     end
  646. end
  647.  
  648. concommand.Add( "+laser", lasersight )
  649.  
  650. function lasersightstop ()
  651. CROptn = (0)
  652. hook.Remove("HUDPaint","lasersight", lasersight)
  653. end
  654.  
  655. concommand.Add( "-laser", lasersightstop )
  656.  
  657. local AdjustCoefficient = 0.02
  658.  
  659.  
  660. local Color_Brightness          = 0.8
  661. local Color_Contrast            = 1.1
  662. local Color_AddRed            = -0.37
  663. local Color_MultiplyRed       = 0.028
  664.  
  665. local AlphaAdd_Alpha                    = 1
  666. local AlphaAdd_Passes                   = 1
  667.                                                                                                                                            
  668. local Bloom_Multiply            = 3.6
  669. local Bloom_Darken                      = 0
  670. local Bloom_Blur                        = 0.1
  671. local Bloom_ColorMul            = 0.5
  672. local Bloom_Passes                      = 1
  673.  
  674. local matNightVision = Material("effects/nightvision")
  675. matNightVision:SetFloat( "$alpha", AlphaAdd_Alpha )
  676.  
  677. local Color_Tab =
  678. {
  679.         [ "$pp_colour_addr" ]           = -1,
  680.         [ "$pp_colour_addg" ]           = Color_AddRed,
  681.         [ "$pp_colour_addb" ]           = -1,
  682.         [ "$pp_colour_brightness" ] = Color_Brightness,
  683.         [ "$pp_colour_contrast" ]       = Color_Contrast,
  684.         [ "$pp_colour_colour" ]         = 0,
  685.         [ "$pp_colour_mulr" ]           = 0 ,
  686.         [ "$pp_colour_mulg" ]           = Color_MultiplyRed,
  687.         [ "$pp_colour_mulb" ]           = 0
  688. }
  689.  
  690. local sndOn = Sound( "items/nvg_on.wav" )
  691. local sndOff = Sound( "items/nvg_off.wav" )
  692.  
  693. if render.GetDXLevel() < 80 then
  694.         AlphaAdd_Passes                 = 1
  695.         AlphaAdd_Alpha                  = 0.6
  696. end
  697.  
  698. local DoNightVision = false
  699. local CurScale = 0.5
  700.  
  701. local render = render
  702.  
  703. local function NightVisionFX()
  704.  
  705.         if CurScale < 0.995 then
  706.                 CurScale = CurScale + AdjustCoefficient * (1 - CurScale)
  707.         end
  708.                        
  709.         for i=1,AlphaAdd_Passes do
  710.        
  711.                 render.UpdateScreenEffectTexture()
  712.                 render.SetMaterial( matNightVision )
  713.                 render.DrawScreenQuad()
  714.                
  715.         end
  716.        
  717.         Color_Tab[ "$pp_colour_brightness" ] = CurScale * Color_Brightness
  718.         Color_Tab[ "$pp_colour_contrast" ] = CurScale * Color_Contrast
  719.        
  720.         DrawColorModify( Color_Tab )
  721.        
  722.         DrawBloom(      Bloom_Darken,                            
  723.                                 CurScale * Bloom_Multiply,        
  724.                                 Bloom_Blur,                                
  725.                                 Bloom_Blur,                                    
  726.                                 Bloom_Passes,                              
  727.                                 CurScale * Bloom_ColorMul,              
  728.                                 1,                                                              
  729.                                 0,                                                              
  730.                                 0 )                                                    
  731. end
  732.  
  733.  
  734. local function ToggleMadVision()
  735.  
  736.     if DoNightVision then
  737.    
  738.                 MDOptn = (0)
  739.                 DoNightVision = false
  740.                 surface.PlaySound( sndOff )
  741.        
  742.                 hook.Remove( "RenderScreenspaceEffects", "NV_Render" )
  743.                
  744.         else
  745.        
  746.                 MDOptn = (1)
  747.                 DoNightVision = true
  748.                 CurScale = 0.5
  749.                 surface.PlaySound( sndOn )
  750.        
  751.                 hook.Add( "RenderScreenspaceEffects", "NV_Render", NightVisionFX )
  752.                
  753.         end
  754.        
  755. end
  756. concommand.Add( "toggle_madvision", ToggleMadVision )
  757.  
  758. local function ThirdPerson()
  759. SSCOptn = (1)
  760.     hook.Add("CalcView", "ThirdPerson", function(ply, pos, angles, fov)
  761.         if ply:Alive() then
  762.                 local view = {}
  763.                 view.origin = pos-(angles:Forward()*100)
  764.                 view.angles = angles
  765.                 view.fov = fov
  766.  
  767.                 return view
  768.         end
  769.    end )
  770. end
  771. concommand.Add( "+ThirdPerson", ThirdPerson )
  772.  
  773. local function StopThirdPerson()
  774. SSCOptn = (0)
  775.    hook.Remove("CalcView", "ThirdPerson", function(ply, pos, angles, fov)
  776.    end)
  777. end
  778. concommand.Add( "-ThirdPerson", StopThirdPerson )
  779.  
  780.  
  781. MsgC(Color(255,255,0),"[MadHack] ")
  782. MsgC(Color(255,255,255),"MadHack Loaded!\n")
Add Comment
Please, Sign In to add comment