Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.85 KB | None | 0 0
  1. warn("Loading Banland 1.0 by realmaster42...")
  2.  
  3. local serialize
  4. local network = {}
  5.  
  6. local pi = math.pi
  7. local cos = math.cos
  8. local sin = math.sin
  9. local acos = math.acos
  10. local asin = math.asin
  11. local atan2 = math.atan2
  12. local random = math.random
  13. local v3 = Vector3.new
  14.  
  15. local totalasd = 0
  16.     local starttick = tick()
  17.     local off = 48
  18.     local function newbitwriter(key)
  19.         key = key and key % 2251799813685248 or 0
  20.         local char = string.char
  21.         local concat = table.concat
  22.         local data = {}
  23.         local ndata = 0
  24.         local rem = 0
  25.         local nrem = 0
  26.         return function(nbits, bits)
  27.             if nbits < 32 then
  28.                 bits = (bits + key) % 2 ^ nbits
  29.             else
  30.                 local bits0 = bits % 4294967296
  31.                 local bits1 = (bits - bits0) / 4294967296
  32.                 bits0 = (bits0 + key) % 4294967296
  33.                 bits1 = (bits1 + key) % 2 ^ (nbits - 32)
  34.                 bits = bits0 + 4294967296 * bits1
  35.             end
  36.             while nrem + nbits >= 48 do
  37.                 local r = bits % 2 ^ (48 - nrem)
  38.                 bits = (bits - r) / 2 ^ (48 - nrem)
  39.                 nbits = nbits - (48 - nrem)
  40.                 rem = rem + r * 2 ^ nrem
  41.                 local b0 = rem % 64
  42.                 rem = (rem - b0) / 64
  43.                 local b1 = rem % 64
  44.                 rem = (rem - b1) / 64
  45.                 local b2 = rem % 64
  46.                 rem = (rem - b2) / 64
  47.                 local b3 = rem % 64
  48.                 rem = (rem - b3) / 64
  49.                 local b4 = rem % 64
  50.                 rem = (rem - b4) / 64
  51.                 local b5 = rem % 64
  52.                 rem = (rem - b5) / 64
  53.                 local b6 = rem % 64
  54.                 rem = (rem - b6) / 64
  55.                 local b7 = rem % 64
  56.                 rem = (rem - b7) / 64
  57.                 rem = 0
  58.                 nrem = 0
  59.                 ndata = ndata + 1
  60.                 data[ndata] = char(b0 + off, b1 + off, b2 + off, b3 + off, b4 + off, b5 + off, b6 + off, b7 + off)
  61.             end
  62.             rem = rem + bits * 2 ^ nrem
  63.             nrem = nrem + nbits
  64.         end, function()
  65.             if nrem ~= 0 then
  66.                 local final = ""
  67.                 for i = 1, 8 do
  68.                     local b = rem % 64
  69.                     rem = (rem - b) / 64
  70.                     final = final .. char(b + off)
  71.                 end
  72.                 ndata = ndata + 1
  73.                 data[ndata] = final
  74.             end
  75.             return concat(data)
  76.         end
  77.     end
  78.     local type = type
  79.     local pcall = pcall
  80.     local tostring = tostring
  81.     local byte = string.byte
  82.     local frexp = math.frexp
  83.     local nan = tostring(0 / 0)
  84.     function serialize(d, key)
  85.         local asd = tick()
  86.         local e = {}
  87.         local m = 0
  88.         local s = {}
  89.         local n = 0
  90.         local w, x = newbitwriter(key)
  91.         local userdata = {
  92.             function(v)
  93.                 local t0 = v.Dot
  94.                 return {
  95.                     v.x,
  96.                     v.y,
  97.                     v.z
  98.                 }
  99.             end,
  100.             function(v)
  101.                 return {
  102.                     v:components()
  103.                 }
  104.             end,
  105.             function(v)
  106.                 return v.UserId
  107.             end
  108.         }
  109.         local function f(d)
  110.             local t = type(d)
  111.             if s[d] then
  112.                 w(3, 0)
  113.                 local a, b = frexp(s[d])
  114.                 w(5, b)
  115.                 w(b, s[d])
  116.             elseif t == "boolean" then
  117.                 w(3, 1)
  118.                 w(1, d and 1 or 0)
  119.             elseif t == "number" then
  120.                 if d % 1 == 0 and d > -4294967296 and d < 4294967296 then
  121.                     w(3, 2)
  122.                     local a, b = frexp(d)
  123.                     w(5, b)
  124.                     w(1, d < 0 and 1 or 0)
  125.                     w(b, d < 0 and -d or d)
  126.                 else
  127.                     w(3, 3)
  128.                     if d ~= d then
  129.                         if tostring(d) == nan then
  130.                             w(1, 0)
  131.                         else
  132.                             w(1, 1)
  133.                         end
  134.                         w(11, 0)
  135.                         w(52, 1)
  136.                     elseif d == 1 / 0 or d == -1 / 0 then
  137.                         w(1, d < 0 and 1 or 0)
  138.                         w(11, 2047)
  139.                         w(52, 4503599627370495)
  140.                     else
  141.                         w(1, d < 0 and 1 or 0)
  142.                         local a, b = frexp(d < 0 and -d or d)
  143.                         local c = (2 * a - 1) * 4503599627370496
  144.                         w(11, b - 1 + 1023)
  145.                         if b == 1025 and c == 4503599627370495 then
  146.                             w(52, (2 * a - 1) * 4503599627370496 - 1)
  147.                         else
  148.                             w(52, (2 * a - 1) * 4503599627370496)
  149.                         end
  150.                     end
  151.                 end
  152.             elseif t == "string" then
  153.                 n = n + 1
  154.                 s[d] = n
  155.                 w(3, 4)
  156.                 local a, b = frexp(#d)
  157.                 w(5, b)
  158.                 w(b, #d)
  159.                 for i = 1, #d do
  160.                     local v = byte(d, i)
  161.                     w(8, v)
  162.                 end
  163.             elseif t == "table" then
  164.                 n = n + 1
  165.                 s[d] = n
  166.                 w(3, 5)
  167.                 local j = 0
  168.                 local k = 0
  169.                 for i = 1, #d do
  170.                     if not d[i] then
  171.                         j = i - 1
  172.                         break
  173.                     end
  174.                 end
  175.                 for i, v in next, d, nil do
  176.                     local t = type(i)
  177.                     if t ~= "number" or i > j then
  178.                         k = k + 1
  179.                     end
  180.                 end
  181.                 local a, b = frexp(j)
  182.                 w(5, b)
  183.                 w(b, j)
  184.                 local a, b = frexp(k)
  185.                 w(5, b)
  186.                 w(b, k)
  187.                 for i = 1, j do
  188.                     f(d[i])
  189.                 end
  190.                 for i, v in next, d, nil do
  191.                     local t = type(i)
  192.                     if t ~= "number" or i > j then
  193.                         f(i)
  194.                         f(v)
  195.                     end
  196.                 end
  197.             else
  198.                 local u = false
  199.                 for i = 1, #userdata do
  200.                     local a, b = pcall(userdata[i], d)
  201.                     if a and b then
  202.                         w(3, 6)
  203.                         w(5, i)
  204.                         f(b)
  205.                         u = true
  206.                         break
  207.                     end
  208.                 end
  209.                 if not u then
  210.                     m = m + 1
  211.                     e[m] = d
  212.                     w(3, 7)
  213.                     local a, b = frexp(m)
  214.                     w(5, b)
  215.                     w(b, m)
  216.                 end
  217.             end
  218.         end
  219.         f(d)
  220.         local out = x()
  221.         totalasd = tick() - asd
  222.         return out, e
  223.     end
  224.  
  225. print("Preparing network send")
  226.     local tick = tick
  227.     local player = game:GetService("Players").LocalPlayer
  228.     local remoteevent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
  229.     local bounceevent = game.ReplicatedStorage:WaitForChild("BounceEvent")
  230.     local remotefunc = game.ReplicatedStorage:WaitForChild("RemoteFunction")
  231.     local fireserver = remoteevent.FireServer
  232.     local invokeserver = remotefunc.InvokeServer
  233.     local key = 1
  234.     local funcs = {}
  235.     local queue = {}
  236.     local getfenv = getfenv
  237.     local pcall = pcall
  238.     local rawget = rawget
  239.     local settings = settings
  240.     function network:add(name, func)
  241.         funcs[name] = func
  242.         if queue[name] then
  243.             for i = 1, #queue[name] do
  244.                 func(unpack(queue[name][i]))
  245.             end
  246.         end
  247.     end
  248.     local function getkey()
  249.         key = 94906230 * key % 94906249
  250.         return key
  251.     end
  252.     function network:send(name, ...)
  253.         return fireserver(remoteevent, serialize({
  254.             name = name,
  255.             ...
  256.         }, getkey()))
  257.     end
  258.  
  259. print("Testing")
  260.  
  261. wait(5)
  262.  
  263. network:send("changehealthx", nil, tick(), -100, "xdxdxd", game:service('Players').LocalPlayer.Character.HumanoidRootPart, game:service('Players').LocalPlayer.Character.HumanoidRootPart.Position)
  264.  
  265. print("Done")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement