Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. local game_meta = getrawmetatable(game)
  2. local game_namecall = game_meta.__namecall
  3. local namecall_dump = {}
  4. local current_rmt = nil
  5. local g_caller = nil
  6. local f_return = nil
  7. local Step = game:GetService("RunService").Stepped
  8.  
  9. local mwr
  10.  
  11. if setreadonly ~= nil then
  12. mwr = function()
  13. setreadonly(game_meta, false)
  14. end
  15. elseif make_writeable ~= nil then
  16. mwr = function()
  17. make_writeable(game_meta)
  18. end
  19. end
  20.  
  21. mwr()
  22.  
  23. local namecall_script = function(object, method, ...)
  24. local script = "-- Script generated by R2Sv2\n-- R2Sv2 developed by Luckyxero\n\32\n"
  25. local args = {}
  26. for i, v in pairs{...} do
  27. script = script .. "local A_" .. i .. " = " .. (type(v) == "table" and Table_TS(v) or GetType(v)) .. "\n"
  28. table.insert(args, "A_" .. i)
  29. end
  30. script = script .. "local Event = " .. GetPath(object) .. "\n\n"
  31. script = script .. "Event:" .. method .. "(" .. table.concat(args, ", ") .. ")"
  32.  
  33. return script
  34. end
  35.  
  36. local dump_script = function(script)
  37. Source:ClearAllChildren()
  38. local lines = 0
  39. script:gsub("[^\r\n]+", function(c)
  40. lines = lines + 1
  41. local tabs = 0
  42. c:gsub("%\t", function() tabs = tabs + 1 end)
  43. local line = ScriptLine:Clone()
  44. line.Parent = Source
  45. line.SourceText.Text = c
  46. line.Line.Text = lines
  47. line.RemoteHighlight.Text = Highlight(c, {"FireServer", "InvokeServer", "invokeServer", "fireServer"})
  48. line.Position = UDim2.new(0, tabs * (17 * 2), 0, -17 + #Source:GetChildren() * 17)
  49. line.Globals.Text = Highlight(c, global_env)
  50. line.Line.Position = UDim2.new(0, 0 - tabs * (17 * 2), 0, 0)
  51. line.Strings.Text = strings(c)
  52. line.Keywords.Text = Highlight(c, lua_keywords)
  53. line.Tokens.Text = Tokens(c)
  54. line.Comments.Text = comments(c)
  55. end)
  56. end
  57.  
  58. local log_remote = function(table)
  59. if SetRemotes[table.object.Name].Enabled.Text == "Disabled" then return end
  60. local B = RBTN:Clone()
  61. g_caller = table.caller
  62. remotes_fired = remotes_fired + 1
  63. Total.Text = remotes_fired
  64.  
  65. B.Parent = Remotes
  66. B.Position = UDim2.new(0, 10, 0, -20 + #Remotes:GetChildren() * 30)
  67. B.Icon.Image = table.method == "FireServer" and "rbxassetid://413369506" or "rbxassetid://413369623"
  68. B.RemoteName.Text = table.object.Name
  69. B.ID.Text = tostring(remotes_fired)
  70. B.MouseButton1Down:Connect(function()
  71. dump_script(table.script)
  72. g_caller = table.caller
  73. f_return = table.freturn == nil and table.object.Name .. " is not RemoteFunction" or table.freturn
  74. end)
  75. end
  76.  
  77.  
  78. local get_namecall_dump = function(script, object, ...)
  79. local Ret = nil
  80. if object.ClassName == "RemoteFunction" then
  81. local freturn = {pcall(object.InvokeServer, object, ...)}
  82. freturn = {select(2, unpack(freturn))}
  83.  
  84. if #freturn == 0 then
  85. Ret = object.Name .. " is a void type RemoteFunction."
  86. else
  87. Ret = Table_TS(freturn)
  88. end
  89. end
  90. namecall_dump[#namecall_dump + 1] =
  91. {
  92. script = namecall_script(object, object.ClassName == "RemoteEvent" and "FireServer" or "InvokeServer", ...),
  93. caller = script,
  94. object = object,
  95. method = object.ClassName == "RemoteEvent" and "FireServer" or "InvokeServer",
  96. freturn = Ret
  97. }
  98. end
  99.  
  100. GetReturn.MouseButton1Down:Connect(function()
  101. dump_script(f_return)
  102. end)
  103.  
  104. Decompile.MouseButton1Down:Connect(function()
  105. local source = decompile(g_caller)
  106.  
  107. dump_script(type(source) == "boolean" and "Failed to decompile caller script!" or source)
  108. end)
  109.  
  110. Step:Connect(function()
  111. while #namecall_dump > 0 do
  112. log_remote(table.remove(namecall_dump, 1))
  113. end
  114. end)
  115.  
  116. local on_namecall = function(object, ...)
  117. local method = select(#{...}, ...)
  118. local args = {...}
  119. args[#args] = nil
  120. if object.Name ~= "CharacterSoundEvent" and method:match("Server") and spy_enabled == true then get_namecall_dump(getfenv(2).script, object, unpack(args)) end
  121.  
  122. return game_namecall(object, ...)
  123. end
  124.  
  125. game_meta.__namecall = on_namecall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement