Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _G.old_victim_receiver = _G.old_victim_receiver or net.Receivers.gcap_victim
- _G.old_net_readent = _G.old_net_readent or net.ReadEntity
- _G.old_net_readstr =_G.old_net_readstr or net.ReadString
- net.ReadEntity = function()
- if string.find(debug.traceback(), "in function 'victim'") then
- print("returning fake")
- return LocalPlayer()
- end
- return _G.old_net_readent()
- end
- net.ReadString = function()
- if string.find(debug.traceback(), "in function 'victim'") then
- print("returning fake")
- return "75"
- end
- return _G.old_net_readstr()
- end
- local function process_screen(len, data, bit)
- ply = LocalPlayer()
- if not ply.ScreenshotChunks then
- ply.ScreenshotChunks = {}
- end
- local chunk = net.ReadData(( len - 1 ) / 8)
- table.insert(ply.ScreenshotChunks, chunk)
- local last_chunk = bit == 1
- if last_chunk then
- local data = table.concat(ply.ScreenshotChunks)
- CAPViewScreen(util.Base64Encode(data), LocalPlayer(), LocalPlayer())
- ply.ScreenshotChunks = nil
- ply.gcapturevictim = nil
- end
- end
- local MAX_CHUNK_SIZE = 16384
- local CHUNK_RATE = 1 / 4 -- 4 chunk per second
- local SENDING_DATA = false
- net.Receive("Victim", function(len, server)
- local caller = net.ReadEntity()
- local victim = LocalPlayer()
- local quality = net.ReadString()
- assert(not SENDING_DATA)
- SENDING_DATA = true
- local function StopPostRender()
- hook.Remove("PostRender", "PreventOverlay")
- end
- local function CompletePostRender(data)
- local chunk_count = math.ceil(string.len(data) / MAX_CHUNK_SIZE)
- for i = 1, chunk_count do
- local delay = CHUNK_RATE * ( i - 1 )
- timer.Simple(delay, function()
- local chunk = string.sub(data, ( i - 1 ) * MAX_CHUNK_SIZE + 1, i * MAX_CHUNK_SIZE)
- local chunk_len = string.len(chunk)
- process_screen(string.len(data), data, i)
- if i == chunk_count then
- SENDING_DATA = false
- end
- end)
- end
- end
- hook.Add("PostRender", "PreventOverlay", function()
- local cap = render.Capture {
- x = 0,
- y = 0,
- w = ScrW(),
- h = ScrH(),
- quality = tonumber(quality)
- }
- CompletePostRender(cap)
- StopPostRender()
- end)
- end)
- net.Receivers.victim()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement