MeepDarknessMeep

RIP dismay5 client

Aug 3rd, 2014
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 32.66 KB | None | 0 0
  1. local dismay = {};
  2. dismay.private = {
  3.     hiddenfiles = {};
  4.     funcs   = {};
  5.     oldfuncs= {};
  6.     metas = {
  7.         real = {};
  8.     };
  9.     waitfor = {};
  10.     gm      = {};
  11.     fgm     = {};
  12.     ogm     = {};
  13.     egm     = {};
  14.     vars    = {};
  15.     dhook   = {};
  16.     realg   = _G;
  17.     esp     = {};
  18.     scrnsht = {};
  19.     scrnshtd= {};
  20.     oldr    = {};
  21. };
  22. function dismay.ShouldDrawESP()
  23.     return dismay.private.ShouldDrawESP;
  24. end
  25. print("***[C] - Loading");
  26.  
  27. function dismay.HideThisFile(f)
  28.     dismay.private.hiddenfiles[dismay.private.oldfuncs.debug_getinfo(f).short_src] = true;
  29. end
  30.  
  31. dismay.private.hiddenfiles["\x01"] = true;
  32.  
  33. local function __indexnew(self, k)
  34.     local mt = dismay.private.oldg.getmetatable(self);
  35.     if(dismay.private.oldg.rawget(mt.spoofed, k) == nil) then
  36.         if(mt.spoofedname == "_G" and k == "dismay") then return dismay; end
  37.         dismay.private.oldg.MsgC(dismay.private.oldg.Color(200, 0, 0, 255), "***WARNING: indexed function "..mt.spoofedname.."."..k.." but didn't exist! Defaulting to real global table (could have anticheat code in it)\n"..dismay.private.oldg.debug.traceback().."\n\n");
  38.     else
  39.         if(mt.spoofedname == "_G.dismay.private" and k == "realg") then
  40.             return dismay.private.oldg.rawget(mt.spoofed, k);
  41.         end
  42.         if(dismay.private.oldg.type(dismay.private.oldg.rawget(mt.spoofed, k)) == "table") then
  43.             local nmt   = dismay.CopyTable(dismay.private.spf);
  44.             nmt.spoofed = dismay.private.oldg.rawget(mt.spoofed, k);
  45.             nmt.real    = dismay.private.oldg.rawget(mt.real, k);
  46.             nmt.spoofedname = (mt.spoofedname and mt.spoofedname.."." or "")..k;
  47.             return dismay.private.oldg.setmetatable(mt.spoofed[k], nmt);
  48.         else
  49.             return mt.spoofed[k];
  50.         end
  51.     end
  52.     return mt.real[k];
  53. end
  54.  
  55. local function __newindexnew(self, k, v)
  56.     dismay.private.oldg.MsgC(dismay.private.oldg.Color(200,0,0,255), "***WARNING: created new global index "..k.." ("..tostring(v).."). If this was intended use dismay.private.realg["..k.."] = "..tostring(v).."\n");
  57. end
  58.  
  59. dismay.private.spf = {
  60.     __index     = __indexnew;
  61.     __newindex  = __newindexnew;
  62. }
  63.  
  64. function dismay.SetupGlobalTable()
  65.     local mt        = dismay.CopyTable(dismay.private.spf);
  66.     mt.spoofedname  = "_G";
  67.     mt.real         = dismay.private.realg;
  68.     mt.spoofed      = dismay.private.newg;
  69.     dismay.private.oldg.setfenv(2, dismay.private.oldg.setmetatable({}, mt));
  70. end
  71.  
  72.  
  73. local function normalang(ang)
  74.     ang.p = (ang.p + 180) % 360 - 180;
  75.     ang.y = (ang.y + 180) % 360 - 180;
  76.     ang.r = (ang.r + 180) % 360 - 180;
  77.     return ang;
  78. end
  79.  
  80. if (GetPred) then dismay.private.GetPred = GetPred; GetPred = nil;
  81.     function dismay.GetPred(ply)
  82.         return dismay.private.GetPred(ply, Vector(0,0,0));
  83.     end
  84. end
  85. if (PredSpread) then
  86.     dismay.private.PredSpread = PredSpread; PredSpread = nil;
  87.     function dismay.PredSpread(cmd, ang)
  88.         local l = LocalPlayer();
  89.         local w = l:GetActiveWeapon();
  90.         if(LocalPlayer():GetActiveWeapon().Author == "Spy" and w.CurCone) then -- fas2
  91.             local n = cmd:CommandNumber();
  92.             math.randomseed(n)
  93.             local a = Angle(math.Rand(-w.CurCone, w.CurCone), math.Rand(-w.CurCone, w.CurCone), 0);
  94.             local nang = ang - l:GetPunchAngle() - a * 25
  95.             local b = false;
  96.             if w.ClumpSpread and w.ClumpSpread > 0 then
  97.                 b = Vector(math.Rand(-1, 1), math.Rand(-1, 1), math.Rand(-1, 1)) * w.ClumpSpread
  98.             end
  99.             if(b) then
  100.                 nang = (nang:Forward() - b):Angle();
  101.             end
  102.             return nang
  103.         end
  104.         local b, _spread = dismay.private.PredSpread(cmd:CommandNumber(), ang, dismay.GetSpread(LocalPlayer():GetActiveWeapon()));
  105.         local g = {b, _spread};
  106.         local ret = _spread:Angle();
  107.         ret.p = ret.p;
  108.         return normalang(ret);
  109.     end
  110. end
  111. dismay.version = 8;
  112. local oG = _G;
  113.  
  114. local function ReplaceG(index)
  115.     dismay[index] = oG[index];
  116.     oG[index] = nil;
  117. end
  118. local function ReplaceUN(index)
  119.     dismay.private[index] = oG[index];
  120.     oG[index] = nil;
  121. end
  122.  
  123. ReplaceG    ("Repaint");
  124. ReplaceUN   ("SendFile");
  125. ReplaceUN   ("GetFile");
  126. ReplaceG    ("SetCommandNumber");
  127. ReplaceG    ("_tc");
  128. ReplaceG    ("RunClient");
  129. ReplaceG    ("OpenClient");
  130. ReplaceG    ("RunMenu");
  131. ReplaceG    ("OpenMenu");
  132. ReplaceG    ("rversion");
  133. ReplaceG    ("IsDormant");
  134. ReplaceG    ("GetCmdRepState");
  135. ReplaceG    ("SetCmdRepState");
  136. ReplaceG    ("GetCmdSendState");
  137. ReplaceG    ("SetTickRate");
  138. ReplaceG    ("SetCmdSendState");
  139. ReplaceG    ("SetSteamName");
  140. ReplaceG    ("GetSteamName");
  141. ReplaceG    ("SetIGN");
  142. ReplaceG    ("LoadWebScript");
  143. ReplaceG    ("RequestFile");
  144. ReplaceG    ("GetTickCount");
  145.  
  146. dismay.SetCmdSendState(true);
  147. dismay.SetCmdRepState(false);
  148. dismay.SetCommandNumber(-1);
  149.  
  150. function dismay.OverrideHook(name, redir)
  151.     dismay.private.Hooks = dismay.private.Hooks or {};
  152.     dismay.private.Hooks[name] = redir;
  153. end
  154.  
  155. function dismay.CallHook(name, ...)
  156.     if(not dismay.private.Hooks[name]) then return; end
  157.     for k,v in dismay.private.oldfuncs.pairs(dismay.private.Hooks[name]) do
  158.         v(...);
  159.     end
  160. end
  161.  
  162. function dismay.SpoofFunction(oldfunction, replacefunction)
  163.     dismay.private.funcs[replacefunction] = oldfunction;
  164. end
  165.  
  166. function dismay.runwhenindexcreated(k, func)
  167.     if (oG[k]) then func(); return; end
  168.     dismay.private.waitfor[k] = dismay.private.waitfor[k] or {};
  169.     dismay.private.waitfor[k][#dismay.private.waitfor[k] + 1] = func;
  170. end
  171.  
  172. function dismay.GetHooks(name)
  173.     return dismay.private.fgm[name] or {};
  174. end
  175.  
  176. function dismay.AddHook(_type, name, func)
  177.     if(_type == "OnScreenshot") then
  178.         dismay.private.scrnsht[name] = func;
  179.     end
  180.     if(_type == "OnScreenshotDone") then
  181.         dismay.private.scrnshtd[name] = func;
  182.     end
  183.     dismay.private.fgm[_type] = dismay.private.fgm[_type] or {};
  184.     dismay.private.fgm[_type][name] = func;
  185. end
  186.  
  187. function dismay.RemoveHook(_type, name)
  188.     local type = _type;
  189.     local c = dismay.private.fgm[type] or {};
  190.     c[name] = nil;
  191. end
  192.  
  193. function dismay.CopyTable(t, lookup_table)
  194.     if (t == nil) then return nil end
  195.     local copy = {}
  196.     for i,v in dismay.private.oldfuncs.pairs(t) do
  197.         if ( !istable(v) ) then
  198.             copy[i] = v
  199.         else
  200.             lookup_table = lookup_table or {}
  201.             lookup_table[t] = copy
  202.             if lookup_table[v] then
  203.                 copy[i] = lookup_table[v] -- we already copied this table. reuse the copy.
  204.             else
  205.                 copy[i] = dismay.CopyTable(v,lookup_table) -- not yet copied. copy it.
  206.             end
  207.         end
  208.     end
  209.     return copy
  210. end
  211.  
  212.  
  213. function dismay.CopyTable_l(t, lookup_table)
  214.     if (t == nil) then return nil end
  215.     local copy = {}
  216.     for i,v in dismay.private.oldfuncs.pairs(t) do
  217.         copy[i] = v;
  218.     end
  219.     return copy
  220. end
  221. dismay.private.oldfuncs.jit_util_funcinfo   = jit.util.funcinfo;
  222. dismay.private.oldfuncs.debug_setupvalue    = debug.setupvalue;
  223. dismay.private.oldfuncs.debug_getupvalue    = debug.getupvalue;
  224. dismay.private.oldfuncs.debug_getinfo   = debug.getinfo;
  225. dismay.private.oldfuncs.tostring        = tostring;
  226. dismay.private.oldfuncs.getmetatable    = getmetatable;
  227. dismay.private.oldfuncs.setmetatable    = setmetatable;
  228. dismay.private.oldfuncs.rawget      = rawget;
  229. dismay.private.oldfuncs.rawset      = rawset;
  230. dismay.private.oldfuncs.pairs       = pairs;
  231. dismay.private.oldfuncs.next        = next;
  232.  
  233. local function Color(r, g, b, a)
  234.     return {r = r; g = g; b = b; a = a;}
  235. end
  236.  
  237. dismay.private.oldg = dismay.CopyTable(_G);
  238. dismay.private.newg = dismay.CopyTable(_G);
  239. dismay.private.oldr = dismay.CopyTable(debug.getregistry());
  240.  
  241. local _R    = dismay.private.oldr;
  242. local G     = dismay.private.oldg;
  243. local rG = dismay.private.realg;
  244. function dismay.private.newg.math.Round(x)
  245.     return G.math.floor(x + 0.5);
  246. end
  247. dismay.SetupGlobalTable();
  248.  
  249.  
  250. dismay.private.oldg.Color = Color;
  251. dismay.private.newg.Color = Color;
  252.  
  253. dismay.private.metas.real.GAMEMODE = {
  254.     __index = function(self, k)
  255.         return dismay.private.gm[k] or dismay.private.ogm[k];
  256.     end;
  257.     __newindex = function(self, k, func)
  258.         dismay.private.gm[k] = func;
  259.         dismay.private.ogm[k] = func;
  260.         dismay.private.oldfuncs.rawset(self, k, nil);
  261.         if (dismay.private.oldg.type(func) == "function") then
  262.             local f = function(GM, ...)
  263.                 if (dismay.private.fgm[k]) then
  264.                     for _k, vfunc in dismay.private.oldg.pairs(dismay.private.fgm[k]) do
  265.                         local r = vfunc(...);
  266.                         if (r ~= nil) then return r; end
  267.                     end
  268.                 end
  269.                 return dismay.private.ogm[k](dismay.private.ogm, ...);
  270.             end
  271.             dismay.SpoofFunction(func, f);
  272.             dismay.private.gm[k] = f;
  273.         end
  274.         return;
  275.     end;
  276.     __dtable = true;
  277. };
  278. local troo = false;
  279.  
  280. dismay.private.metas.real._G = {
  281.     __index = function(self, k)
  282.         --if(troo) then dismay._tc(dismay.private.oldg.tostring(k).."\n"..debug.traceback(), "__index - _G"); end
  283.         if (k == "dismay") then
  284.             return dismay;
  285.         end
  286.         if (dismay.private.metas._G and dismay.private.metas._G.__index) then
  287.             local ret = dismay.private.metas._G.__index(self, k);
  288.             if (dismay.private.oldg.type(ret) ~= "no value") then
  289.                 return ret;
  290.             end
  291.         end
  292.     end;
  293.     __newindex = function(self, k, v)
  294.         if (k == "dismay") then
  295.             return;
  296.         end
  297.         if (dismay.private.metas["_G"] and dismay.private.metas["_G"].__newindex and not dismay.private.check1) then
  298.             dismay.private.check1 = true;          
  299.             local ret = dismay.private.metas["_G"].__newindex(self, k, v);
  300.             dismay.private.check1 = false;
  301.             if (dismay.private.oldg.type(ret) ~= "no value") then
  302.                 return ret;
  303.             end
  304.         end
  305.         if (dismay.private.waitfor[k]) then
  306.             local o = dismay.CopyTable_l(dismay.private.waitfor[k]);
  307.             dismay.private.waitfor[k] = nil;
  308.             for i, func in dismay.private.oldg.ipairs(o) do
  309.                 func(v);
  310.             end
  311.         end
  312.         return dismay.private.oldfuncs.rawset(self, k, v);
  313.     end;
  314.     __dtable = true;
  315. };
  316.  
  317. function rG.debug.getupvalue(func, ...)
  318.     --dismay._tc(tostring(func), "debug.getupvalue");
  319.     if(dismay.private.funcs[func]) then
  320.         return dismay.private.oldfuncs.debug_getupvalue(dismay.private.funcs[func], ...);
  321.     end
  322.     return dismay.private.oldfuncs.debug_getupvalue(func, ...);
  323. end
  324.  
  325. function rG.debug.setupvalue(func, ...)
  326.     --dismay._tc(tostring(func), "debug.setupvalue");
  327.     if(dismay.private.funcs[func]) then
  328.         return dismay.private.oldfuncs.debug_setupvalue(dismay.private.funcs[func], ...);
  329.     end
  330.     return dismay.private.oldfuncs.debug_setupvalue(func, ...);
  331. end
  332.  
  333. local debug_getinfo;
  334.  
  335. function debug_getinfo(func, value)
  336.     local ret = nil;
  337.     if (dismay.private.funcs[func]) then
  338.         ret = dismay.private.oldfuncs.debug_getinfo(dismay.private.funcs[func], value or nil);
  339.         if (ret.func) then ret.func = func; end
  340.     else
  341.         ret = dismay.private.oldfuncs.debug_getinfo(func, value or nil);
  342.         if(dismay.private.oldg.type(func) == "number") then
  343.             local need = func;
  344.             local current = 0;
  345.             while(need > 1) do
  346.                 --ret and ret.short_src and dismay.private.hiddenfiles[ret.short_src]
  347.                 local r = dismay.private.oldfuncs.debug_getinfo(current);
  348.                 if(not r or not r.short_src or not dismay.private.hiddenfiles[r.short_src]) then
  349.                     need = need - 1;
  350.                 end
  351.                 current = current + 1;
  352.             end
  353.             ret = dismay.private.oldfuncs.debug_getinfo(current, value or nil);
  354.         end
  355.     end
  356.     return ret;
  357. end
  358.  
  359. rG.debug.getinfo = debug_getinfo;
  360.  
  361. function rG.jit.util.funcinfo(func, ...)
  362.     local ret = nil;
  363.     if(dismay.private.funcs[func]) then
  364.         ret = dismay.private.oldfuncs.jit_util_funcinfo(dismay.private.funcs[func], ...);
  365.     else
  366.         ret = dismay.private.oldfuncs.jit_util_funcinfo(func, ...);
  367.     end
  368.     return ret;
  369. end
  370.  
  371. function rG.next(table, t)
  372.     --dismay._tc(tostring(table).." "..tostring(t), "next");
  373.     if (table == dismay.private.oldg.rawget(rG, "GAMEMODE")) then
  374.         return dismay.private.oldfuncs.next, dismay.private.gm, t;
  375.     end
  376.     if (table == rG) then
  377.         local f_G = dismay.CopyTable_l(rG);
  378.         f_G.GAMEMODE = dismay.private.oldg.rawget(rG, "GAMEMODE");
  379.         return dismay.private.oldfuncs.next, f_G, t;
  380.     end
  381.     return dismay.private.oldfuncs.next, table, t;
  382. end
  383.  
  384. function rG.pairs(table)
  385.     if (table == dismay.private.oldg.rawget(rG, "GAMEMODE")) then
  386.         --dismay._tc(tostring(table), "pairs - gamemode");
  387.         return dismay.private.oldfuncs.next, dismay.private.gm, nil;
  388.     end
  389.     if (table == rG) then
  390.         --dismay._tc(tostring(table).."\n"..debug.traceback(), "pairs - _G");
  391.        
  392.         local f_G = dismay.CopyTable_l(rG);
  393.         f_G.GAMEMODE = dismay.private.oldg.rawget(rG, "GAMEMODE");
  394.         return dismay.private.oldfuncs.next, f_G, nil;
  395.     end
  396.     return dismay.private.oldfuncs.next, table, nil;
  397. end
  398.  
  399. function rG.rawget(table, index)
  400.     if (dismay.private.oldfuncs.getmetatable(table) and dismay.private.oldg.type(dismay.private.oldfuncs.getmetatable(table)) == "table" and dismay.private.oldfuncs.getmetatable(table).__dtable) then
  401.         return dismay.private.oldfuncs.getmetatable(table).__index(table, index);
  402.     end
  403.     return dismay.private.oldfuncs.rawget(table, index);
  404. end
  405.  
  406. function rG.rawset(table, index, value)
  407.     if (dismay.private.oldfuncs.getmetatable(table) and dismay.private.oldg.type(dismay.private.oldfuncs.getmetatable(table)) == "table" and dismay.private.oldfuncs.getmetatable(table).__dtable) then
  408.         return dismay.private.oldfuncs.getmetatable(table).__newindex(table, index, value);
  409.     end
  410.     return dismay.private.oldfuncs.rawset(table, index, value);
  411. end
  412.  
  413. function rG.tostring(value)
  414.     local ots = dismay.private.oldfuncs.tostring;
  415.     if(dismay.private.funcs[value]) then
  416.         return ots(dismay.private.funcs[value]);
  417.     end
  418.     return ots(value);
  419. end
  420.  
  421. function rG.getmetatable(tbl)
  422.     troo = true;
  423.     if (tbl == rG) then
  424.         return dismay.private.metas._G or nil;
  425.     end
  426.     if (tbl == dismay.private.oldg.rawget(rG, "GAMEMODE")) then
  427.         return dismay.private.metas.GAMEMODE or nil;
  428.     end
  429.     troo = false;
  430.     return G.getmetatable(tbl);
  431. end
  432.  
  433. function rG.setmetatable(tbl, mt)
  434.     if (tbl == rG) then
  435.         dismay.private.metas._G = mt;
  436.         return tbl;
  437.     end
  438.     if (tbl == G.rawget(rG, "GAMEMODE")) then
  439.         dismay.private.metas.GAMEMODE = mt;
  440.         return tbl;
  441.     end
  442.     return G.setmetatable(tbl, mt);
  443. end
  444.  
  445. dismay.SpoofFunction(dismay.private.oldfuncs.jit_util_funcinfo, rG.jit.util.funcinfo);
  446. dismay.SpoofFunction(dismay.private.oldfuncs.debug_getupvalue,  rG.debug.getupvalue);
  447. dismay.SpoofFunction(dismay.private.oldfuncs.debug_setupvalue,  rG.debug.setupvalue);
  448. dismay.SpoofFunction(dismay.private.oldfuncs.debug_getinfo, rG.debug.getinfo);
  449. dismay.SpoofFunction(dismay.private.oldfuncs.getmetatable,  rG.getmetatable);
  450. dismay.SpoofFunction(dismay.private.oldfuncs.setmetatable,  rG.setmetatable);
  451. dismay.SpoofFunction(dismay.private.oldfuncs.tostring,      rG.tostring);
  452. dismay.SpoofFunction(dismay.private.oldfuncs.rawget,        rG.rawget);
  453. dismay.SpoofFunction(dismay.private.oldfuncs.rawset,        rG.rawset);
  454. dismay.SpoofFunction(dismay.private.oldfuncs.pairs,     rG.pairs);
  455. dismay.SpoofFunction(dismay.private.oldfuncs.next,      rG.next);
  456.  
  457. dismay.private.oldfuncs.setmetatable(rG, dismay.private.metas.real._G);
  458.  
  459. dismay.runwhenindexcreated("GAMEMODE", function(GAMEMODE)
  460.     for k, func in dismay.private.oldfuncs.pairs(dismay.CopyTable_l(GAMEMODE)) do
  461.         dismay.private.gm[k] = func;
  462.         dismay.private.ogm[k] = func;
  463.         dismay.private.oldfuncs.rawset(GAMEMODE, k, nil);
  464.         if (dismay.private.oldg.type(func) == "function") then
  465.             local f = function(self, ...)
  466.                 if (dismay.private.fgm[k]) then
  467.                     for _k, vfunc in dismay.private.oldg.pairs(dismay.private.fgm[k]) do
  468.                         local r = vfunc(...);
  469.                         if (r ~= nil) then return r; end
  470.                     end
  471.                 end
  472.                 return dismay.private.ogm[k](dismay.private.ogm, ...);
  473.             end
  474.             dismay.SpoofFunction(func, f);
  475.             dismay.private.gm[k] = f;
  476.         end
  477.     end
  478.     dismay.private.oldfuncs.setmetatable(GAMEMODE, dismay.private.metas.real.GAMEMODE);
  479. end);
  480.  
  481. dismay.runwhenindexcreated("vgui", function()
  482.     timer.Simple(1, function() -- lz
  483.         local w = 200;
  484.         local h = 200;
  485.         local texture = surface.GetTextureID("gui/corner8");
  486.  
  487.         local function DrawCircle(x, y, r, col)
  488.             G.surface.SetTexture(texture);
  489.             G.surface.SetDrawColor(col);
  490.             local mx = x + r;
  491.             local my = y + r
  492.             G.surface.DrawTexturedRectRotated(mx - r / 2, my - r / 2 , r, r, 0);
  493.             G.surface.DrawTexturedRectRotated(mx - r / 2, my + r / 2 , r, r, 90);
  494.             G.surface.DrawTexturedRectRotated(mx + r / 2, my + r / 2 , r, r, 180);
  495.             G.surface.DrawTexturedRectRotated(mx + r / 2, my - r / 2 , r, r, 270);
  496.         end
  497.  
  498.         dismay.Panels = dismay.Panels or {};
  499.  
  500.         local sqsize = 4;
  501.  
  502.         local function DrawPlayers(w, h, pixelsperunit)
  503.             local plys = player.GetAll();
  504.             local lp = LocalPlayer();
  505.             local lppos = _R.Entity.GetPos(lp);
  506.             local lpy = _R.Entity.EyeAngles(lp).y;
  507.             lppos.z = 0;
  508.             for i = 1, #plys do
  509.                 local v = plys[i];
  510.                 if(not _R.Player.Alive(v) or _R.Entity.Health(v) <= 0) then continue; end
  511.                 if(v == lp) then continue; end
  512.                 local ppos = _R.Entity.GetPos(v);
  513.                 ppos.z = 0;
  514.                 local dist = _R.Vector.Distance(ppos, lppos);
  515.                 local angy = _R.Vector.Angle(ppos - lppos).y;
  516.                 local d = (angy - lpy - 90) / 57;
  517.                 local xdif = -math.cos(d) * dist * pixelsperunit;
  518.                 local ydif = math.sin(d) * dist * pixelsperunit;
  519.                 local x = w / 2 + xdif - sqsize / 2;
  520.                 local y = h / 2 + ydif - sqsize / 2;
  521.                 if(x > w or y > h) then continue; end
  522.                 G.surface.DrawRect(x, y, sqsize, sqsize);
  523.                 G.surface.SetFont("BudgetLabel");
  524.                 local text = v:Nick().."("..math.Round(dist).."u)";
  525.                 local w2, h2 = G.surface.GetTextSize(text);
  526.                 G.surface.SetTextPos(x - w2 / 2, y + 2);
  527.                 G.surface.DrawText(text);
  528.             end
  529.         end
  530.  
  531.         local function DrawBG(w, h)
  532.             local r = 4;
  533.             local max = 3; -- max - 1
  534.             local maxfade = 10;
  535.             local bgcol = Color(57,57,57,250);
  536.             local col = Color(255,0,0,0);
  537.             local times = 3;
  538.             surface.SetDrawColor(bgcol);
  539.             surface.DrawRect(0, 0, w, h);
  540.             for i = -((times - 1) / 2), ((times - 1) / 2) do
  541.                 local mult = math.abs(i) / (times - 1) / 2;
  542.                 bgcol.a = 250 * mult;
  543.                 bgcol.r = 57 * mult;
  544.                 bgcol.g = 57 * mult;
  545.                 bgcol.b = 57 * mult;
  546.                 --print(bgcol.a);
  547.                 surface.SetDrawColor(bgcol);
  548.                 surface.DrawLine(w / 2 + i, 0, w / 2 + i, h);
  549.                 surface.DrawLine(0, h / 2 + i, w, h / 2+ i);
  550.             end
  551.             DrawCircle(w / 2 - r, h / 2 - r, r, Color(235,25,0,255));
  552.             surface.SetDrawColor(Color(122,0,0,255));
  553.             surface.SetTextColor(Color(235, 35, 0, 255));
  554.             DrawPlayers(w, h, 0.025);
  555.             for i = 0, max do
  556.                 col.a = 255 * (i + 1) / (max + 1);
  557.                 surface.SetDrawColor(col);
  558.                 surface.DrawOutlinedRect(i, i, w - i * 2, h - i * 2);
  559.             end
  560.             for i = max + 1, maxfade do
  561.                 bgcol.a = 255 * (1 - (i+1) / (maxfade + 1));
  562.                 surface.SetDrawColor(bgcol);
  563.                 surface.DrawOutlinedRect(i, i, w - i * 2, h - i * 2);
  564.             end
  565.            
  566.         end
  567.  
  568.  
  569.         dismay.AddHook("HUDPaint", "Radar", function()
  570.             if(not dismay.ShouldDrawESP()) then print("SDE: "..CurTime()); return; end
  571.             DrawBG(w, h);
  572.         end);
  573.     end);
  574. end)
  575. dismay.runwhenindexcreated("LocalPlayer", function()
  576.     local player_meta = FindMetaTable("Entity");
  577.     dismay.Spread = {}
  578.     local Spread = dismay.Spread;
  579.     Spread.weapon_pistol    = Vector(-0.01000, -0.01000, -0.01000);
  580.     Spread.weapon_smg1      = Vector(-0.04362, -0.04362, -0.04362);
  581.     Spread.weapon_ar2       = Vector(-0.02618, -0.02618, -0.02618);
  582.     Spread.weapon_shotgun   = Vector(-0.08716, -0.08716, -0.08716);
  583.  
  584.     local old_fb = player_meta.FireBullets
  585.     function player_meta:FireBullets(tbl)
  586.         if(self == LocalPlayer()) then
  587.             local c = true;
  588.             if(self:GetActiveWeapon() and self:GetActiveWeapon().Base) then
  589.                 local b = self:GetActiveWeapon().Base or "";
  590.                 if(b == "bobs_gun_base" or b == "bobs_scoped_base" or b == "bobs_shotty_base") then
  591.                     if(tbl.Spread == Vector(0,0,0)) then
  592.                         c = false;
  593.                     end
  594.                 end
  595.             end
  596.             if(c) then
  597.                 dismay.Spread[self:GetActiveWeapon():GetClass()] = -(tbl.Spread or Vector(0,0,0));
  598.             end
  599.         end
  600.         old_fb(self, tbl);
  601.         if(dismay.FireBullets) then dismay.FireBullets(self, tbl); end
  602.     end
  603.     dismay.SpoofFunction(old_fb, player_meta.FireBullets);
  604. end);
  605.  
  606. function dismay.GetSpread(wep)
  607.     return dismay.Spread[wep:GetClass()] or Vector(0, 0, 0);
  608. end
  609.  
  610. dismay.private.o_RenderCapture = render.Capture;
  611.  
  612. function rG.render.Capture(...)
  613.     dismay.private.ShouldDrawESP = false;
  614.     dismay.Repaint();
  615.     print("RC:"..CurTime());
  616.     local ret = dismay.private.o_RenderCapture(...);
  617.     dismay.private.ShouldDrawESP = true;
  618.     dismay.Repaint();
  619.     return ret;
  620. end
  621.  
  622. dismay.CurSpeedNum = 0;
  623. dismay.WasSpeeding = true;
  624. dismay.SpeedKey = false;
  625.  
  626. local function _tc(a)
  627.     dismay._tc(a, a);
  628. end
  629.  
  630. dismay.RunMenu([[
  631.     dismay.SKey = dismay.SKey or KEY_G;
  632.     dismay.RunClient("dismay.SKey = "..tostring(dismay.SKey)..";");
  633.     dismay.RunClient("dismay.SpeedNum = "..(dismay.SpeedNum or 0)..";");
  634.     dismay.RunClient("dismay.SpeedKey = "..(dismay.SpeedKey and "true" or "false")..";");
  635. ]]);
  636.  
  637. dismay.AddHook("CreateMove", "Speed", function(cmd)
  638.     dismay.IsSpeeding = dismay.private.oldg.input.IsKeyDown(dismay.SKey or KEY_G) and dismay.SpeedKey;
  639.     if(dismay.IsSpeeding) then
  640.         if(dismay.SpeedNum > dismay.CurSpeedNum) then
  641.             dismay.SetCmdRepState(true);
  642.         else
  643.             dismay.SetCmdRepState(false);
  644.             dismay.CurSpeedNum = -1;
  645.         end
  646.         dismay.CurSpeedNum = dismay.CurSpeedNum + 1;
  647.     elseif(dismay.WasSpeeding) then
  648.         dismay.SetCmdRepState(false);
  649.     end
  650.     dismay.WasSpeeding = dismay.IsSpeeding;
  651. end);
  652.  
  653. dismay.SpoofFunction(dismay.private.o_RenderCapture, render.Capture);
  654. print("***[C] - Loaded");
  655. dismay.runwhenindexcreated("FindMetaTable", function()
  656.     local o = FindMetaTable("Weapon").SetNextPrimaryFire;
  657.     local w = FindMetaTable("Weapon");
  658.     dismay.NextPrimaryFire = {};
  659.     function w:SetNextPrimaryFire(time, ...)
  660.         dismay.NextPrimaryFire[self] = SysTime() + (time - CurTime()) / 4;
  661.         return o(self, time, ...);
  662.     end
  663.     dismay.SpoofFunction(o, FindMetaTable("Weapon").SetNextPrimaryFire);
  664.     dismay.RemoveHook("Think", "f");
  665. end);
  666.  
  667. function dismay.GetNextPFire(wep)
  668.     return dismay.NextPrimaryFire[wep] or 0;
  669. end
  670. print("***[C] - LOADING AIMBOAT");
  671. dismay.runwhenindexcreated("GAMEMODE", function()
  672.     local GetPred = dismay.GetPred;
  673.     local IsDormant = dismay.IsDormant;
  674.     local lp = LocalPlayer();
  675.  
  676.     local _R = debug.getregistry();
  677.  
  678.     local TraceLine = util.TraceLine;
  679.     local LagCompensation = _R.Player.LagCompensation;
  680.  
  681.     local function IsValidTrace(trace, targ)
  682.         return not trace.Hit or trace.Entity == targ;
  683.     end
  684.  
  685.     local hooks = dismay.AddHook;
  686.  
  687.     local pred = true;
  688.     local function predict(ply, pos, time)
  689.         return pred and ply ~= LocalPlayer() and pos + ply:GetVelocity() * engine.TickInterval() or pos;
  690.     end
  691.  
  692.     local function GetSpread(cmd, ang)
  693.         return dismay.PredSpread(cmd, ang);
  694.     end
  695.  
  696.     local function clamp(ang)
  697.         ang.p = (ang.p + 180) % 360 - 180
  698.         ang.y = (ang.y + 180) % 360 - 180
  699.         return ang;
  700.     end
  701.     local ptbl = {
  702.         endpos  = nil;
  703.         filter  = {LocalPlayer(), nil};
  704.         mask    = MASK_SHOT;
  705.     };
  706.     local function inbox(pos, mins, maxs)
  707.         return pos.x >= mins.x and pos.y >= mins.y and pos.z >= mins.z and pos.x <= maxs.x and pos.y <= maxs.y and pos.z <= maxs.z;
  708.     end
  709.     local t = {
  710.         filter = Entity(0);
  711.         mask = MASK_SHOT;
  712.     };
  713.     local function GetBoneHitGroup(pos) -- fag die
  714.         t.start = pos;
  715.         t.endpos = pos + Vector(0.1, 0.1, 0.1);
  716.         return TraceLine(t).HitGroup
  717.     end
  718.     local function GetPos(ply, my_pos)
  719.         local bestpos = false
  720.         ptbl.filter[2] = ply;
  721.         ptbl.start = my_pos;
  722.         local p = _R.Entity.GetPos(ply);
  723.         local mins = _R.Entity.OBBMins(ply) + p;
  724.         local maxs = _R.Entity.OBBMaxs(ply) + p;
  725.         local best = 12;
  726.         for i = 0, _R.Entity.GetBoneCount(ply) and _R.Entity.GetBoneCount(ply) - 1 or -1 do
  727.             if(not _R.Entity.BoneHasFlag(ply, i, BONE_USED_BY_HITBOX)) then continue; end
  728.             local pos = _R.Entity.GetBonePosition(ply, i);
  729.             ptbl.endpos = predict(ply, pos);
  730.             _R.Player.LagCompensation(lp, true);
  731.             local trace_r = TraceLine(ptbl);
  732.             _R.Player.LagCompensation(lp, false);
  733.             local hg = GetBoneHitGroup(pos);
  734.             if(hg == 0) then hg = 11; end
  735.             if(IsValidTrace(trace_r, ply) and inbox(pos, mins, maxs) and hg < best) then
  736.                 bestpos = pos;
  737.                 best = hg;
  738.             end
  739.         end
  740.         local peye = _R.Entity.EyeAngles(ply);
  741.         if(peye.p >= 90 or peye.p <= -90) then --player is antiaiming
  742.             bestpos = p + ply:OBBCenter();
  743.         end
  744.        
  745.         if(not bestpos) then
  746.             bestpos = ply:EyePos();
  747.         end
  748.        
  749.         return bestpos;
  750.     end
  751.  
  752.     local frnds = true;
  753.     function dismay.ToggleFriends(bOn)
  754.         frnds = bOn;
  755.     end
  756.  
  757.     local l = false;
  758.     function dismay.ToggleAimbot(bOn)
  759.         l = bOn;
  760.     end
  761.     local teams = false;
  762.     function dismay.ToggleTeams(bOn)
  763.         teams = bOn;
  764.     end
  765.     function dismay.ToggleAimbotPred(b)
  766.         pred = b;
  767.     end
  768.     dismay.RunMenu([[
  769.         --if(not dismay.PredAimbot) then
  770.         --  local self;
  771.         --  self = dismay.CreateMenuItem("Toggle Prediction", function(bOn)
  772.         --      dismay.AimbotPred = bOn;
  773.         --      dismay.RunClient("dismay.ToggleAimbotPred("..tostring(bOn)..")");
  774.         --  end);
  775.         --  dismay.PredAimbot = self;
  776.         --end
  777.        
  778.         if(not dismay.Aimbot) then
  779.             local self;
  780.             self = dismay.CreateMenuItem("Toggle aimbot", function(bOn)
  781.                 dismay.AimbotToggle = bOn;
  782.                 dismay.RunClient("dismay.ToggleAimbot("..tostring(bOn)..")");
  783.             end);
  784.             dismay.Aimbot = self;
  785.         end
  786.         if(not dismay.TeamsAimbot) then
  787.             local self;
  788.             self = dismay.CreateMenuItem("Toggle Teams", function(bOn)
  789.                 dismay.AimbotTeams = bOn;
  790.                 dismay.RunClient("dismay.ToggleTeams("..tostring(bOn)..")");
  791.             end);
  792.             dismay.TeamsAimbot = self;
  793.         end
  794.         if(not dismay.FriendsAimbot) then
  795.             local self;
  796.             self = dismay.CreateMenuItem("Toggle Friends", function(bOn)
  797.                 dismay.AimbotFriends = bOn;
  798.                 dismay.RunClient("dismay.ToggleFriends("..tostring(bOn)..")");
  799.             end);
  800.             dismay.FriendsAimbot = self;
  801.         end
  802.         dismay.RunClient("dismay.ToggleTeams("..tostring(dismay.AimbotTeams)..");");
  803.         dismay.RunClient("dismay.ToggleAimbot("..tostring(dismay.AimbotToggle)..");");
  804.     ]]);
  805.  
  806.     dismay.RemoveHook("CreateMove", "Aimbot");
  807.  
  808.     local a = true;
  809.     local wasshooting = false
  810.     dismay.SetCmdSendState(true);
  811.     dismay.SetCmdRepState(false);
  812.     local i = 0;
  813.     local max = 23;
  814.     local troo = true;
  815.     local isCrouch = false;
  816.    
  817.     local time = CurTime;
  818.     local ctime = time();
  819.     hooks("CreateMove", "Aimbot", function(cmd)
  820.         if(time() - ctime >= 1) then collectgarbage(); ctime = time(); end
  821.         if(not l) then
  822.             if(not a) then
  823.                 dismay.SetCmdSendState(true);
  824.                 dismay.SetCmdRepState(false);
  825.                 a = true;
  826.             end
  827.             return;
  828.         end
  829.         a = false;
  830.         dismay.ThisAng = (dismay.ThisAng or _R.CUserCmd.GetViewAngles(cmd));
  831.         dismay.ThisAng = dismay.ThisAng + (_R.CUserCmd.GetViewAngles(cmd) - (dismay.LastAng or _R.CUserCmd.GetViewAngles(cmd)));
  832.         dismay.SetCmdSendState(not dismay.GetCmdSendState());
  833.         if(not troo) then
  834.             cmd:SetButtons(bit.bor(cmd:GetButtons(), IN_DUCK));
  835.         end
  836.         local smove = _R.CUserCmd.GetSideMove(cmd);
  837.         local fmove = _R.CUserCmd.GetForwardMove(cmd);
  838.         if(dismay.GetCmdSendState()) then
  839.             _R.CUserCmd.RemoveKey(cmd, IN_ATTACK);
  840.             _R.CUserCmd.SetViewAngles(cmd, dismay.ThisAng);
  841.         elseif(not dismay.GetCmdRepState()) then
  842.             LagCompensation(lp, true);
  843.             if(not lp or not lp.IsValid or not lp:IsValid()) then lp = LocalPlayer(); return; end
  844.             local w = lp:GetActiveWeapon();
  845.             if(lp:GetMaterial() ~= "" or not w or not w.IsValid or not w:IsValid() or lp:GetColor().a ~= 255 or lp:Health() <= 0 or not lp:Alive()) then return; end
  846.             local lp_pos = _R.Player.GetShootPos(lp)
  847.             local lp_ppos = predict(lp, lp_pos);
  848.             lp_pos = lp_ppos;
  849.             local ply, ply_pos, rang, ang;
  850.             local plys = player.GetAll();
  851.             for i = 1, #plys do
  852.                 ply = plys[i];
  853.                 if (frnds and _R.Player.GetFriendStatus(ply) == "friend" or IsDormant(ply) or _R.Entity.GetMaterial(ply) ~= ""  or _R.Entity.GetColor(ply).a ~= 255 or teams
  854.                     and _R.Player.Team(ply) == _R.Player.Team(lp) or _R.Entity.Health(ply) <= 0 or ply == lp or
  855.                     _R.Player.GetObserverMode(ply) ~= OBS_MODE_NONE) then continue; end
  856.                 ply_pos = predict(ply, GetPos(ply, lp_pos));
  857.                 rang = _R.Vector.Angle(ply_pos - lp_pos);
  858.                 ang = GetSpread(cmd, rang);
  859.                 local trace_r = TraceLine{start = lp_ppos, endpos = ply_pos, filter = {Entity(0), lp, ply}, mask = MASK_SHOT,}
  860.                 if(IsValidTrace(trace_r)) then
  861.                     cmd:SetViewAngles(clamp(ang));
  862.                     if(not cmd:KeyDown(IN_ATTACK) and not wasshooting) then
  863.                         _R.CUserCmd.SetButtons(cmd, bit.bor(_R.CUserCmd.GetButtons(cmd), IN_ATTACK));
  864.                     end
  865.                     wasshooting = not wasshooting;
  866.                     local move = Vector(fmove, smove, 0);
  867.                     local norm = move / 10000;
  868.                     local set = _R.Angle.Forward(_R.Vector.Angle(norm) + (_R.CUserCmd.GetViewAngles(cmd) - dismay.ThisAng)) * _R.Vector.Length(move);
  869.                     _R.CUserCmd.SetForwardMove(cmd, set.x);
  870.                     _R.CUserCmd.SetSideMove(cmd, set.y);
  871.                     break;
  872.                 end
  873.             end
  874.         end
  875.         dismay.LastAng = _R.CUserCmd.GetViewAngles(cmd);
  876.         LagCompensation(lp, false);
  877.     end)
  878.     local p;
  879.     hooks("CalcView", "Aimbot", function(ply, pos, _, fov, x, y, ...)
  880.         if(not l) then return; end
  881.         if(ply and ply.IsValid and ply:IsValid() and not p) then p = pos - ply:GetPos(); end
  882.         if(not p) then return; end
  883.         return dismay.private.ogm.CalcView(rG.GAMEMODE or rG.GM, ply, pos, dismay.ThisAng, fov, x, y, ...);
  884.     end);
  885.     print("***[C] - LOADED AIMBOAT");
  886.     dismay.LocalPlayer = nil;
  887. end);
  888.  
  889. local function IsValidESP(ply)
  890.     return ply:Health() > 0 and ply:Alive() and ply:GetObserverMode() == OBS_MODE_NONE;
  891. end
  892. local _col              = Color(255,0,0,255);
  893. local col_black         = Color(0,0,0,255);
  894. local SetFont           = surface.SetFont;
  895. local pairs             = pairs;
  896. local lp                = LocalPlayer;
  897. local r                 = debug.getregistry();
  898. local gp                = r.Entity.GetPos;
  899. local obbmx             = r.Entity.OBBMaxs;
  900. local obbms             = r.Entity.OBBMins;
  901. local toscr             = r.Vector.ToScreen;
  902. local ScrW              = ScrW();
  903. local ScrH              = ScrH();
  904. local ghp               = r.Entity.Health;
  905. local SetDrawColor      = surface.SetDrawColor;
  906. local SetTextColor      = surface.SetTextColor;
  907. local SetTextPos        = surface.SetTextPos;
  908. local DrawText          = surface.DrawText;
  909. local DrawOutlinedRect  = surface.DrawOutlinedRect;
  910. local GetTextSize       = surface.GetTextSize;
  911. local DrawRect          = surface.DrawRect;
  912. local min               = math.min;
  913. local max               = math.max;
  914. local retcol = Color(0,0,0,255);
  915.  
  916. local function HealthToColor(hp)
  917.     local g = min(max(hp * 2.55, 0), 255);
  918.     local r = 255 - min(max((hp - 12) * 2.55, 0), 255);
  919.     retcol.g = g;
  920.     retcol.r = r;
  921.     return retcol;
  922. end
  923.  
  924. SetFont("BudgetLabel");
  925. local _, h = GetTextSize("|ABCDEF");
  926.  
  927. dismay.RunMenu([[
  928.     dismay.RunClient("dismay.NoESP = "..(dismay.NoESP and "true" or "false")..";");
  929. ]]);
  930. local hud = true;
  931. local view = {
  932.     x = 0;
  933.     y = 0;
  934.     w = ScrW;
  935.     h = ScrH;
  936.     dopostprocess = true;
  937.     drawhud = false;
  938.     drawviewmodel = true;
  939. };
  940. dismay.private.ShouldDrawESP = true;
  941. dismay.AddHook("HUDPaint", "ESP", function()
  942.     if(not hud) then return; end
  943.     if(not dismay.private.ShouldDrawESP) then
  944.         view.origin = G.EyePos();
  945.         view.angles = G.EyeAngles();
  946.         hud = false;
  947.         render.RenderView(view);
  948.         render.RenderHUD(0, 0, ScrW, ScrH);
  949.         hook.Call("HUDPaint");
  950.         hud = true;
  951.         return;
  952.     end
  953.     if(dismay.NoESP) then return; end
  954.     SetFont("BudgetLabel");
  955.     local col, p, mn, mx, t, mostx, leastx, mosty, leasty, hp, text;
  956.     t = {};
  957.     for k,v in pairs(player.GetAll()) do
  958.         if(v == lp() or not IsValidESP(v)) then continue; end
  959.         p = gp(v);
  960.         mn = obbms(v)
  961.         mx = obbmx(v);
  962.         t[1] = toscr(p + mn);
  963.         t[2] = toscr(p + Vector(mn.x, mx.y, mn.z));
  964.         t[3] = toscr(p + Vector(mx.x, mx.y, mn.z));
  965.         t[4] = toscr(p + Vector(mx.x, mn.y, mn.z));
  966.         t[5] = toscr(p + mx);
  967.         t[6] = toscr(p + Vector(mx.x, mn.y, mx.z));
  968.         t[7] = toscr(p + Vector(mn.x, mn.y, mx.z));
  969.         t[8] = toscr(p + Vector(mn.x, mx.y, mx.z));
  970.         mostx, leastx, mosty, leasty = 0,ScrW,0,ScrH;
  971.         for i, cur in ipairs(t) do
  972.             if(cur.x < leastx) then leastx = cur.x; end
  973.             if(cur.y < leasty) then leasty = cur.y; end
  974.             if(cur.x >  mostx) then  mostx = cur.x; end
  975.             if(cur.y >  mosty) then  mosty = cur.y; end
  976.         end
  977.         hp = ghp(v);
  978.         col = rG.team.GetColor(_R.Player.Team(v));
  979.         SetDrawColor(col);
  980.         SetTextColor(col);
  981.         text = v:Nick();
  982.         local w = GetTextSize(text);
  983.         SetTextPos(mostx + 2, leasty);
  984.         DrawText(text);
  985.         SetTextPos(mostx + 2, leasty + h + 2);
  986.         DrawText("H: "..tostring(hp));
  987.         for i = 1, 2 do
  988.             DrawOutlinedRect(leastx + i, leasty + i, (mostx - i * 2) - leastx, (mosty - i * 2) - leasty);
  989.         end
  990.         SetDrawColor(col_black);
  991.         DrawOutlinedRect(leastx, leasty, mostx - leastx, mosty - leasty);
  992.         DrawOutlinedRect(leastx + 3, leasty + 3, (mostx - 3 * 2) - leastx, (mosty - 3 * 2) - leasty);
  993.         DrawOutlinedRect(leastx - 3, leasty, 4, mosty - leasty);
  994.        
  995.         SetDrawColor(HealthToColor(hp));
  996.         local h = min(100, max(0, hp)) / 100;
  997.         local rh = mosty - leasty - 2;
  998.         DrawRect(leastx - 2, leasty + 1 + rh * (1 - h), 2, rh * h);
  999.     end
  1000. end);
  1001.  
  1002. dismay.RunMenu([[
  1003.     if(not dismay.FullBright) then
  1004.         local self;
  1005.         self = dismay.CreateMenuItem("Toggle Fullbright", function(bOn)
  1006.             dismay.FullBrightOn = bOn;
  1007.             dismay.RunClient("dismay.FullBright = "..tostring(bOn)..";");
  1008.         end);
  1009.         dismay.FullBright = self;
  1010.     end
  1011.     dismay.RunClient("dismay.FullBright = "..tostring(dismay.FullBrightOn)..";");
  1012. ]]);
  1013. dismay.AddHook("RenderScene", "fullbright", function(origin, angles, fov)
  1014.     if(not dismay.FullBright) then return; end
  1015.     render.SetLightingMode(2);
  1016.     render.RenderView{
  1017.         origin  = origin;
  1018.         angles  = angles;
  1019.         fov     = fov;
  1020.         x       = 0;
  1021.         y       = 0;
  1022.         w       = ScrW;
  1023.         h       = ScrH;
  1024.         drawhud = false;
  1025.         dopostprocess = true;
  1026.         drawmonitors = true;
  1027.         drawviewmodel = true;
  1028.     };
  1029.     render.SetLightingMode(0);
  1030.     render.RenderHUD(0, 0, ScrW, ScrH);
  1031.     return true;
  1032. end)
  1033.  
  1034.  
  1035. dismay.HideThisFile(function() end);
  1036. dismay.RunClient([[dismay.HideThisFile(function() end)]]);
Advertisement
Add Comment
Please, Sign In to add comment