Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. function banner()
  2. print("Welcome to SwatDoge's chat program")
  3. print("")
  4. end
  5.  
  6. function cls()
  7. term.clear()
  8. term.setCursorPos(1, 1)
  9. end
  10.  
  11. function name()
  12. account_name = user
  13. cls()
  14. write("What would you like your name to be? ")
  15. account_name = read()
  16. password()
  17. end
  18.  
  19. function password()
  20. account_password = admin
  21. cls()
  22. write("Welcome "..account_name..", Type a password you'd want to use: ")
  23. write("")
  24. account_password = read()
  25. cls()
  26. login()
  27. end
  28.  
  29. function first_name()
  30. if account_name == nil then
  31. name()
  32. else
  33. print(name)
  34. cls()
  35. login()
  36. end
  37. end
  38.  
  39. function login()
  40. local account_name_check
  41. local account_password_check
  42. print("Login with your information.")
  43. write("Username: ")
  44. account_name_check = read()
  45. write("Password: ")
  46. account_password_check = read()
  47.  
  48. if (account_name_check == account_name) and (account_password_check == account_password) then
  49. cls()
  50. chat()
  51. else
  52. cls()
  53. print("wrong username or password")
  54. login()
  55. end
  56. end
  57.  
  58. function chat()
  59. write("send your message: ")
  60. message = read()
  61. if message ~= nil then
  62. rednet.send(21, account_name .. ": " .. message)
  63. end
  64. end
  65.  
  66. while true do
  67. id, reply = rednet.receive("swatdoge")
  68. print(reply)
  69. end
  70.  
  71. message = nil
  72. chat()
  73. end
  74. end
  75.  
  76. if pocket then
  77. rednet.open("back")
  78. else
  79. rednet.open("top")
  80. end
  81.  
  82. local account_password
  83. local account_name
  84. banner()
  85. first_name()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement