Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Probably a very popular method of detouring, very simple, and effective if run before localization or no localization is used.
- ]]--
- local Detours = {} -- Our Detours table, we are going to store our detoured functions here.
- local ProtectedFiles = {
- "aimbot.lua",
- "esp.lua"
- }
- local function DetourFunction(originalFunction, newFunction) -- Function that handles the detouring for us
- Detours[newFunction] = originalFunction -- Save the old function
- return newFunction -- We want to return our new, detoured function
- end
- file.Read = DetourFunction(file.Read, function(fileName, path) -- For this example, we are going to be detouring file.Read, this function has the arguments of string filename and string path
- for k,v in next, ProtectedFiles do
- if (string.find(filename, v) then -- We want to protect our files
- return "haha not today bitchboy" -- Return an intimidating string so they know you're not messing around
- end
- end
- return Detours[file.Read](fileName, path) -- Return the original function of file.Read so files that you dont care about can still be read by addons that use things like configs, etc.
- end)
Advertisement
Add Comment
Please, Sign In to add comment