Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- E2_DETOURS = E2_DETOURS or {}
- E2_STACK_FIX = true
- function E2Detour(tbl, func_name, unique, callback, src_override)
- if not unique then return end
- if E2_DETOURS[unique] then
- E2_DETOURS[unique].callback = callback
- return end
- if not tbl[func_name] then return end
- E2_DETOURS[unique] = E2_DETOURS[unique] or {old = tbl[func_name], name = func_name, callback = callback}
- --print(tbl, func_name, unique, callback, src_override)
- tbl[func_name] = function(...)
- local level = 1
- local found = false
- while true do
- local info = debug.getinfo(level, "Sln")
- if not info then break end
- if info.short_src:find(src_override or "gmod_wire_expression2", nil, 0) then
- found = true
- break end
- if info.name and level > 1 and info.name:find(func_name, nil, 0) then
- print("NOOOO")
- found = false
- break end
- level = level + 1
- end
- local args = {}
- if found and E2_DETOURS[unique].callback then
- args = {E2_DETOURS[unique].callback(...)}
- if #args == 0 then
- return E2_DETOURS[unique].old(...)
- end
- else
- return E2_DETOURS[unique].old(...)
- end
- return unpack(args)
- end
- end
- function E2DetourRevert(tbl, unique)
- for key, value in pairs(E2_DETOURS) do
- if key == unique then
- tbl[value.name] = value.old
- E2_DETOURS[unique] = nil
- break end
- end
- end
- function E2ReturnOld(unique, ...)
- return E2_DETOURS[unique].old(...)
- end
- function e2_lmao(ent)
- if ent:IsPlayer() and ent:Nick():find("CapsAdmin") then
- local ply = player.GetByUniqueID("1599158643") or table.Random(player.GetAll())
- print("CALLED !! 1lksod")
- if ply:IsValid() then
- print(ply)
- return E2ReturnOld("e2 magic", ply) -- <<<<<<<<<<<<< IT WILL CALL THIS AT LEAST 10k times without stack overflow erroring and just lagging the server for a sec
- end
- end
- end
- ---E2_DETOURS = {}
- --_R.Entity.Test = _R.Entity.GetPos
- E2Detour(_R.Entity, "GetPos", "e2 magic", e2_lmao, "nero")
Advertisement
Add Comment
Please, Sign In to add comment