computercam

client

Oct 3rd, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. rednet.open("back")
  2. rednet.broadcast("SERVER LOCATE")
  3. local id, message = rednet.receive(5)
  4. if not message then
  5. error("No server located. Server may have crashed. (ERR: CALL_TIMEOUT)")
  6. end
  7. serverid = id
  8. print("Located Server: ", serverid)
  9. print("Client starting")
  10. write("Username: ")
  11. username = read()
  12. write("Password: ")
  13. password = read("*")
  14. rednet.send(serverid, "login_start")
  15. local id, message = rednet.receive()
  16. if message == "AUTHENTICATE NOW" then
  17. rednet.send(serverid, username)
  18. rednet.send(serverid, password)
  19. id, session = rednet.receive()
  20. if session == "err" then
  21. error("Incorrect username or password (ERR: Server 404 (usr/pass not found))")
  22. end
  23. print("Got session. ", session)
  24. id, message = rednet.receive()
  25. print(message)
  26. print("When you're finished with the computer. Please type 'logout'")
  27. end
  28. while true do
  29. write("> ")
  30. message = read()
  31. if message == "logout" or message == "exit" or message == "shutdown" then
  32. os.shutdown()
  33. end
  34. if message == "upgrade" then
  35. shell.run("rm startup")
  36. shell.run("pastebin get 1VHszN6d startup")
  37. os.reboot()
  38. end
  39. if message == "chat" then
  40. shell.run("chat join smyd ", username)
  41. end
  42. end
Add Comment
Please, Sign In to add comment