Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i,v in ipairs(rs.getSides()) do
- if peripheral.getType(v) == "modem" then
- rednet.open(v)
- break
- end
- end
- print("Username:")
- local user = read()
- local lines = {}
- local function getRednetInput()
- id, msg = rednet.receive()
- msg = textutils.unserialize(msg)
- if type(msg) == "table" then
- print("["..msg[1].."] "..msg[2])
- end
- end
- local function broadcastMessages()
- local line = read()
- local packet = {}
- table.insert(packet, user)
- table.insert(packet, line)
- rednet.broadcast(textutils.serialize(packet))
- end
- while true do
- parallel.waitForAny(getRednetInput, broadcastMessages)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement