Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. whois = function()
  2. local x,y,z = gps.locate(5)
  3. range = 64 + (y-96) * ((384-64)/(255-96))
  4. rednet.broadcast("Relay at ("..x..","..y..","..z..") has ID "..os.getComputerID().." and range"..range)
  5. print("responded to WHOIS request")
  6. end
  7.  
  8.  
  9. rednet.open("back")
  10.  
  11. history = {}
  12.  
  13. while true do
  14.  
  15. id,msg = rednet.receive()
  16. print("received message from "..id)
  17. send = true
  18. for i in history do
  19. if i == msg then
  20. send = false
  21. end
  22. end
  23.  
  24. if msg == "whois" then
  25. whois()
  26. send = false
  27. end
  28.  
  29. if send == true then
  30. rednet.broadcast(msg)
  31. table.insert(history, msg)
  32. print("relayed message successfully")
  33. end
  34.  
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement