Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Written by Autumn on V3rmillion
- -- Fixed and tweaked by Raspberry Pi
- local enabled = {
- -- Set any of these objects to false to stop logging them
- BindableEvent = false;
- BindableFunction = false;
- RemoteEvent = true;
- RemoteFunction = true;
- }
- local ignore = {
- GetSetting = true;
- GetSelection = true;
- SelectionChanged = true;
- GetAwaiting = true;
- }
- local meta,oldmeta = getrawmetatable(game),{}
- setreadonly(meta,false)
- for i,v in next,meta do oldmeta[i] = v end
- function formatargs(args,showkeys)
- if #args == 0 then return "N/A" end
- local strargs = {}
- for k,v in next,args do
- local argstr = ""
- if type(v) == "string" then
- argstr = "\"" .. v .. "\""
- elseif type(v) == "table" then
- argstr = "{" .. formatargs(v,true) .. "}"
- else
- argstr = tostring(v)
- end
- if showkeys and type(k) ~= "number" then
- table.insert(strargs,k.."="..argstr)
- else
- table.insert(strargs,argstr)
- end
- end
- return table.concat(strargs, ", ")
- end
- local realmethods = {}
- realmethods.Fire = Instance.new("BindableEvent").Fire
- realmethods.Invoke = Instance.new("BindableFunction").Invoke
- realmethods.FireServer = Instance.new("RemoteEvent").FireServer
- realmethods.InvokeServer = Instance.new("RemoteFunction").InvokeServer
- meta.__namecall = function(...)
- local tbl = {...}
- local k = tbl[#tbl]
- local t = tbl[1]
- if (k == "Fire" or k == "Invoke" or k == "FireServer" or k == "InvokeServer") and (enabled[t.ClassName] and not ignore[t.Name]) then
- local args = {}
- for i=2,#tbl-1 do
- args[i] = tbl[i]
- end
- local ret = {realmethods[k](...)}
- local scriptcaller = getfenv(2).script
- if scriptcaller == nil then
- scriptcaller = "Not Found"
- end
- warn(t.ClassName.." called! " .." From Script: " .. tostring(scriptcaller:GetFullName()) .."!\nPath: "..t:GetFullName().."\n".."Args: "..formatargs(args).."\nReturn: "..formatargs(ret))
- return unpack(ret)
- else
- return oldmeta.__namecall(...)
- end
- end
Add Comment
Please, Sign In to add comment