MeepDarknessMeep

Untested net logger

Jul 5th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | None | 0 0
  1. local nt    = dismay.CopyTable(net);
  2. local nnet  = {};
  3. local NetStuff = {};
  4. dismay.NetStuff = NetStuff;
  5. local changed = {
  6.     Start = true;
  7.     SendToServer = true;
  8. };
  9. local curname;
  10. local curnet;
  11. for k,v in pairs(net) do
  12.     if(changed[k]) then continue; end
  13.     if(string.sub(k, 1, 5) == "Write") then continue; end
  14.     nnet[k] = function(...)
  15.         local ret = nt[k](...);
  16.         curnet[#curnet + 1] = {type = string.sub(k, 6); value = {...}};
  17.         return ret;
  18.     end
  19. end
  20.  
  21. function nnet.Start(name)
  22.     curnet = {};
  23.     curname = name;
  24.     return nt.Start(name);
  25. end
  26.  
  27. function nnet.SendToServer()
  28.     NetStuff[curname] = NetStuff[curname] or {};
  29.     NetStuff[curname][#NetStuff[curname] + 1] = curnet;
  30.     return nt.SendToServer();
  31. end
  32.  
  33. for k,v in pairs(net) do
  34.     dismay.SpoofFunction(net[k], nnet[k]);
  35.     net[k] = nnet[k];
  36. end
Advertisement
Add Comment
Please, Sign In to add comment