Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --MolnServer
- term.clear()
- term.setCursorPos(1,1)
- rednet.open("right")
- while true do
- local id, msg = rednet.receive()
- if msg == "ctlg" then
- print("I started the grab")
- local int = 1
- while fs.list("")[int] ~= nil do
- rednet.broadcast(fs.list("")[int])
- int = int + 1
- end
- rednet.broadcast("Done!")
- local id, name = rednet.receive()
- print("Someone is grabbing "..name)
- local file = fs.open(name, "r")
- local text = file.readAll("")
- file.close()
- rednet.broadcast(name.."_copy")
- sleep(0.1)
- rednet.broadcast(text)
- print("Succesful grab")
- elseif msg == "svths"
- then
- local id, name = rednet.receive()
- local id, text = rednet.receive()
- local file = fs.open(name, "w")
- file.write(text)
- file.close()
- print("I just received a new file called: ") print(name)
- else
- print("I got a msg: "..msg)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement