nguyenminhnghia

Untitled

Feb 2nd, 2019
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. -- Written by Autumn on V3rmillion
  2. -- Fixed and tweaked by Raspberry Pi
  3. local enabled = {
  4. -- Set any of these objects to false to stop logging them
  5. BindableEvent = false;
  6. BindableFunction = false;
  7. RemoteEvent = true;
  8. RemoteFunction = true;
  9. }
  10.  
  11. local ignore = {
  12. GetSetting = true;
  13. GetSelection = true;
  14. SelectionChanged = true;
  15. GetAwaiting = true;
  16. }
  17.  
  18. local meta,oldmeta = getrawmetatable(game),{}
  19. setreadonly(meta,false)
  20. for i,v in next,meta do oldmeta[i] = v end
  21. function formatargs(args,showkeys)
  22. if #args == 0 then return "N/A" end
  23. local strargs = {}
  24. for k,v in next,args do
  25. local argstr = ""
  26. if type(v) == "string" then
  27. argstr = "\"" .. v .. "\""
  28. elseif type(v) == "table" then
  29. argstr = "{" .. formatargs(v,true) .. "}"
  30. else
  31. argstr = tostring(v)
  32. end
  33. if showkeys and type(k) ~= "number" then
  34. table.insert(strargs,k.."="..argstr)
  35. else
  36. table.insert(strargs,argstr)
  37. end
  38. end
  39. return table.concat(strargs, ", ")
  40. end
  41. local realmethods = {}
  42. realmethods.Fire = Instance.new("BindableEvent").Fire
  43. realmethods.Invoke = Instance.new("BindableFunction").Invoke
  44. realmethods.FireServer = Instance.new("RemoteEvent").FireServer
  45. realmethods.InvokeServer = Instance.new("RemoteFunction").InvokeServer
  46. meta.__namecall = function(...)
  47. local tbl = {...}
  48. local k = tbl[#tbl]
  49. local t = tbl[1]
  50. if (k == "Fire" or k == "Invoke" or k == "FireServer" or k == "InvokeServer") and (enabled[t.ClassName] and not ignore[t.Name]) then
  51. local args = {}
  52. for i=2,#tbl-1 do
  53. args[i] = tbl[i]
  54. end
  55. local ret = {realmethods[k](...)}
  56. local scriptcaller = getfenv(2).script
  57. if scriptcaller == nil then
  58. scriptcaller = "Not Found"
  59. end
  60. warn(t.ClassName.." called! " .." From Script: " .. tostring(scriptcaller:GetFullName()) .."!\nPath: "..t:GetFullName().."\n".."Args: "..formatargs(args).."\nReturn: "..formatargs(ret))
  61. return unpack(ret)
  62. else
  63. return oldmeta.__namecall(...)
  64. end
  65. end
Add Comment
Please, Sign In to add comment