Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. _G.old_victim_receiver = _G.old_victim_receiver or net.Receivers.gcap_victim
  2. _G.old_net_readent = _G.old_net_readent or net.ReadEntity
  3. _G.old_net_readstr =_G.old_net_readstr or net.ReadString
  4. net.ReadEntity = function()
  5. if string.find(debug.traceback(), "in function 'victim'") then
  6. print("returning fake")
  7. return LocalPlayer()
  8. end
  9.  
  10. return _G.old_net_readent()
  11. end
  12. net.ReadString = function()
  13. if string.find(debug.traceback(), "in function 'victim'") then
  14. print("returning fake")
  15. return "75"
  16. end
  17.  
  18. return _G.old_net_readstr()
  19. end
  20.  
  21. local function process_screen(len, data, bit)
  22. ply = LocalPlayer()
  23. if not ply.ScreenshotChunks then
  24. ply.ScreenshotChunks = {}
  25. end
  26. local chunk = net.ReadData(( len - 1 ) / 8)
  27. table.insert(ply.ScreenshotChunks, chunk)
  28. local last_chunk = bit == 1
  29. if last_chunk then
  30. local data = table.concat(ply.ScreenshotChunks)
  31. CAPViewScreen(util.Base64Encode(data), LocalPlayer(), LocalPlayer())
  32. ply.ScreenshotChunks = nil
  33. ply.gcapturevictim = nil
  34. end
  35. end
  36.  
  37. local MAX_CHUNK_SIZE = 16384
  38. local CHUNK_RATE = 1 / 4 -- 4 chunk per second
  39. local SENDING_DATA = false
  40. net.Receive("Victim", function(len, server)
  41. local caller = net.ReadEntity()
  42. local victim = LocalPlayer()
  43. local quality = net.ReadString()
  44. assert(not SENDING_DATA)
  45. SENDING_DATA = true
  46.  
  47. local function StopPostRender()
  48. hook.Remove("PostRender", "PreventOverlay")
  49. end
  50.  
  51. local function CompletePostRender(data)
  52. local chunk_count = math.ceil(string.len(data) / MAX_CHUNK_SIZE)
  53. for i = 1, chunk_count do
  54. local delay = CHUNK_RATE * ( i - 1 )
  55. timer.Simple(delay, function()
  56. local chunk = string.sub(data, ( i - 1 ) * MAX_CHUNK_SIZE + 1, i * MAX_CHUNK_SIZE)
  57. local chunk_len = string.len(chunk)
  58. process_screen(string.len(data), data, i)
  59. if i == chunk_count then
  60. SENDING_DATA = false
  61. end
  62. end)
  63. end
  64. end
  65.  
  66. hook.Add("PostRender", "PreventOverlay", function()
  67. local cap = render.Capture {
  68. x = 0,
  69. y = 0,
  70. w = ScrW(),
  71. h = ScrH(),
  72. quality = tonumber(quality)
  73. }
  74. CompletePostRender(cap)
  75. StopPostRender()
  76. end)
  77. end)
  78. net.Receivers.victim()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement