Advertisement
Guest User

startup

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