Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- whois = function()
- local x,y,z = gps.locate(5)
- range = 64 + (y-96) * ((384-64)/(255-96))
- rednet.broadcast("Relay at ("..x..","..y..","..z..") has ID "..os.getComputerID().." and range"..range)
- print("responded to WHOIS request")
- end
- rednet.open("back")
- history = {}
- while true do
- id,msg = rednet.receive()
- print("received message from "..id)
- send = true
- for i in history do
- if i == msg then
- send = false
- end
- end
- if msg == "whois" then
- whois()
- send = false
- end
- if send == true then
- rednet.broadcast(msg)
- table.insert(history, msg)
- print("relayed message successfully")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement