Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- rednet.open("back")
- local host_id = os.computerID()
- local uzyt = {}
- local uzyt_size = 0
- rednet.broadcast(host_id.." dolaczyl")
- rednet.broadcast("test", "test")
- print(host_id.." dolaczyl")
- while true do
- param1, param2, param3, param4 = os.pullEvent()
- if param1 == "rednet_message" and param3 == "test" and param4 == "test" then
- rednet.send(param2, "T", "test")
- local istnieje = false
- for i=0,uzyt_size do
- if uzyt[i] == param2 then
- istnieje = true
- break
- end
- end
- if not istnieje then
- uzyt[uzyt_size] = param2
- uzyt_size = uzyt_size + 1
- end
- end
- if param1 == "rednet_message" and param3 == "T" and param4 == "test" then
- local istnieje = false
- for i=0,uzyt_size do
- if uzyt[i] == param2 then
- local istnieje = true
- end
- end
- if not istnieje then
- uzyt[uzyt_size] = param2
- uzyt_size = uzyt_size + 1
- print("Na czacie znajduje sie "..param2)
- end
- end
- if param1 == "rednet_message" then
- print(param2.."- "..param3)
- end
- if param1 == "key" then
- write("Twoja wiadomosc: ")
- local mes = read()
- if mes == "exit" then
- rednet.broadcast(host_id.." wyszedl")
- textutils.slowPrint("wychodze...")
- rednet.close("back")
- break
- elseif mes == "list" then
- write("Na czacie znajduja sie: ")
- for i=0,uzyt_size-1 do
- write(uzyt[i])
- end
- write("\n")
- else
- print(host_id.."- "..mes)
- rednet.broadcast(mes)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement