Advertisement
Guest User

startup

a guest
Aug 26th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | None | 0 0
  1. term.setBackgroundColor(colors.white)
  2. term.setTextColor(colors.blue)
  3.  
  4. term.clear()
  5. term.setCursorPos(1,1)
  6.  
  7. modem = peripheral.wrap("back")
  8. modem.open(199)
  9.  
  10. file = fs.open("data", "r")
  11. accounts = textutils.unserialise(file.readAll())
  12. file.close()
  13.  
  14. term.setCursorPos(13,3)
  15. print("Bienvenue sur Alpha Energy !")
  16.  
  17. term.setCursorPos(1,5)
  18. print("Veuillez entrer vos identifiants ci-dessous afin d'acceder a votre compte personnel.")
  19.  
  20. term.setCursorPos(2,8)
  21. print("Nom d'utilisateur :")
  22. term.setCursorPos(2,9)
  23. print("Mot de passe :")
  24.  
  25. term.setCursorPos(22,8)
  26. username = read()
  27. term.setCursorPos(17,9)
  28. password = read("*")
  29.  
  30. if accounts[username] == password then
  31.   term.clear()
  32.   term.setCursorPos(15,5)
  33.   print("Identification reussie.")
  34.  
  35.   term.setCursorPos(12,6)
  36.   print("Chargement de votre compte...")
  37.  
  38.   term.setCursorPos(10,8)
  39.   textutils.slowPrint("---------------------------------", 30)
  40.  
  41.   sleep(2)
  42.  
  43.   file = fs.open("username_temp","w")
  44.   file.write(username)
  45.   file.close()
  46.  
  47.   os.run({}, "account")
  48. elseif accounts[username] == nil then
  49.   term.clear()
  50.   term.setCursorPos(14,6)
  51.  
  52.   print("Ce compte n'existe pas !")
  53.  
  54.   sleep(3)
  55.   os.reboot()
  56. else
  57.   term.clear()
  58.   term.setCursorPos(14,6)
  59.  
  60.   print("Mot de passe incorrect !")
  61.  
  62.   sleep(3)
  63.   os.reboot()
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement