Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = peripheral.wrap("top")
- rednet.open("top")
- serverID = 0
- cdtServer = 2
- os.loadAPI("APIs/server")
- --END FUNCTIONS
- server.TestConnection("true")
- shell.run("clear")
- write("Username: ")
- connectionName = io.read()
- write("Password: ")
- connectionPassword = io.read()
- shell.run("clear")
- print("Logging in.")
- server.connect(connectionName, connectionPassword)
- print("Hey, ", connectionName)
- local senderID, message, distance = rednet.receive()
- if message == "login" then
- function running()
- write("Command: ")
- command = io.read()
- if command == "kill-server" then
- write("Are you sure you want to kill the server?: [y/n] ")
- answer = io.read()
- if answer == "y" then
- print("Sending command.")
- rednet.send(serverID, "kill")
- end
- else
- if command == "chat" then
- print("Let's go...")
- shell.run("domain-chat")
- else
- if command == "msgb" then
- rednet.send(serverID, "sendToMon")
- local senderID, message, distance = rednet.receive()
- write("Display ID: ")
- displayID = tonumber(io.read())
- rednet.send(serverID, displayID)
- write("Message: ")
- local msg = io.read()
- print("Sending")
- rednet.send(serverID, msg)
- running()
- else
- if command == "cdt" then
- rednet.send(cdtServer, "cdt-start")
- local senderID, message, distance = rednet.receive(5)
- if message == "start" then
- print("Select an OS from the ones below:")
- print("1. Recovery mode")
- option = io.read()
- if option == "1" then
- print("Starting File Transfer...")
- rednet.send(cdtServer, "cdt-iso-1")
- end
- else
- print("CDT Server not online/avaliable")
- running()
- end
- else
- if command == "lua" then
- shell.run("lua")
- running()
- else
- server.disconnect()
- end
- end
- end
- end
- end
- end
- running()
- else
- print("Sorry, The server returned: ",message, " Sounds like something is wrong, maybe incorrect username or password?")
- end
Add Comment
Please, Sign In to add comment