Advertisement
matope3

porte code 2

Sep 2nd, 2014
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.92 KB | None | 0 0
  1. m = peripheral.wrap("top")
  2. local o = 0
  3. local code = "32456324"
  4. m.setTextScale(3)
  5. m.setTextColor(colors.yellow)
  6. while o == 0 do
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. print("Bonjour on/off")
  10. local valEnof = read()
  11. if valEnof == "on" then
  12. local f = 0
  13. m.setBackgroundColor(colors.green)
  14. m.clear()
  15. sleep(2)
  16. m.setCursorPos(1,1)
  17. m.write("Ferme")
  18. while f == 0 do
  19. term.clear()
  20. term.setCursorPos(1,1)
  21. print("Bienvenue")
  22. print("Veuillez entrez le mot de passe pour que la porte s'ouvre.")
  23. local valEnmdp = read()
  24. if valEnmdp == code then
  25. rs.setOutput("back", true)
  26. m.clear()
  27. m.setCursorPos(1,1)
  28. m.write("Ouvert")
  29. sleep(3)
  30. rs.setOutput("back", false)
  31. m.clear()
  32. m.setCursorPos(1,1)
  33. m.write("Ferme")
  34. valEnmdp = 0
  35. elseif valEnmdp == "off" then
  36. f =  f + 1
  37. else
  38. print("mauvais mot de passe")
  39. end
  40. end
  41. elseif valEnof == "off" then
  42. m.setBackgroundColor(colors.red)
  43. m.clear()
  44. term.clear()
  45. print("OFF")
  46. read()
  47. end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement