Python1320

Untitled

Dec 5th, 2010
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.56 KB | None | 0 0
  1. E2_DETOURS = E2_DETOURS or {}
  2.  
  3. function E2Detour(tbl, func_name, unique, callback, src_override)
  4.    
  5.     if not unique then return end
  6.     if E2_DETOURS[unique] then return end
  7.    
  8.     E2_DETOURS[unique] = E2_DETOURS[unique] or {old = tbl[func_name], name = func_name}
  9.    
  10.     tbl[func_name] = function(...)
  11.        
  12.         if E2_STACK_FIX then return end
  13.    
  14.         local level = 1
  15.         local found = false
  16.         while true do
  17.        
  18.             local info = debug.getinfo(level, "Sln")
  19.        
  20.             if not info then break end
  21.                        
  22.             if info.short_src:find(src_override or "gmod_wire_expression2", nil, 0) then
  23.                 found = true
  24.             break end
  25.            
  26.             level = level + 1
  27.        
  28.         end
  29.         local args = {}
  30.        
  31.         if found and callback then
  32.             args = {callback(...)}
  33.            
  34.             if #args == 0 then
  35.                 return E2_DETOURS[unique].old(...)
  36.             end
  37.         else
  38.             return E2_DETOURS[unique].old(...)
  39.         end
  40.        
  41.        
  42.         return unpack(args)
  43.     end
  44. end
  45.  
  46. function E2DetourRevert(tbl, unique)
  47.     for key, value in pairs(E2_DETOURS) do
  48.         if key == unique then
  49.             tbl[value.name] = value.old
  50.             E2_DETOURS[unique] = nil
  51.         break end
  52.     end
  53. end
  54.  
  55. function E2ReturnOld(unique, ...)
  56.     return E2_DETOURS[unique].old(...)
  57. end
  58.  
  59. function e2_lmao(ent)
  60.     if ent:IsPlayer() and ent:Nick():find("CapsAdmin") then
  61.         local ply = player.GetByUniqueID("1599158643")
  62.         print("CALLED !! 1lksod")
  63.         if ply:IsValid() then
  64.             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
  65.         end
  66.     end
  67. end
  68.  
  69. E2Detour(_R.Entity, "GetPos", "e2 magic", e2_lmao, "nero")
Advertisement
Add Comment
Please, Sign In to add comment