What this function does is it goes through the server's own list of addon's hooks and tries to find any that hook the particular function you want to find, and if it does, it returns the first identifier used for that particular function you want to hook. With the whitelisted identifier to your preferred hooked function, you can then run your own hook with the same identifier, so that you can fly by undetected by any whitelist checking for hooks.
local function GetWhitelistedIdentifier(hookfunction) for k, v in pairs(hook.GetTable()) do --for loop to grab each key and it's value from the hook table if (k == hookfunction) then --if hook.GetTable()[k] == our hooked function's name then local availableidentifier = table.FindNext(hook.GetTable()[k]) --the location of the availableidentifier we can hook.. (I left this the way it is in this post for better documentation, optimize it if you do happen to use it.) return (table.KeyFromValue(hook.GetTable()[k],availableidentifier)) --return the actual name of the availableidentifier we can hook. end end return -1 --return failure, passed all and didn't find a whitelisted identifier for our hook.. end
Comment