Advertisement
karelvysinka

Dowload DOOR for players

May 9th, 2015
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.73 KB | None | 0 0
  1. function zacatek()
  2. if fs.exists("vari") then
  3. term.clear()
  4. kuna = fs.open("vari", "r")
  5. pas = kuna.readAll()
  6. kuna.close()
  7. kuna2 = fs.open("strana", "r")
  8. sig = kuna2.readAll()
  9. kuna2.close()
  10. jes()
  11. else
  12. pass()
  13. end
  14. end
  15.  
  16.  
  17. function jes()
  18.  if pas == ""  then
  19.  pass()
  20. else
  21.  open()
  22.  end
  23. end
  24.  
  25. function pass()
  26.  
  27. term.setCursorPos(10, 10)
  28. print("PLEASE TYPE YOUR NEW PASSWORD")
  29. term.setCursorPos(20, 11)
  30. pas = read()
  31. kuna = fs.open("vari", "w")
  32. kuna.write(pas)
  33. kuna.close()
  34. term.clear()
  35. term.setCursorPos(10,10)
  36. print("PASSWORD SAVED")
  37. sleep(3)
  38. term.clear()
  39. term.setCursorPos(1, 10)
  40. print("PLEASE SELECT SIGNAL OUTPUT SIDE: LEFT RIGHT BACK TOP  BOTTON")
  41. term.setCursorPos(20, 11)
  42. pos = read()
  43. if pos == "LEFT" then
  44.    sig = "left"
  45.    good()
  46.    elseif pos == "RIGHT" then
  47.    sig = "right"
  48.    good()
  49.    elseif pos == "TOP" then
  50.    sig = "top"
  51.    good()
  52.    elseif pos == "BOTTON" then
  53.    sig = "botton"
  54.    good()
  55.    elseif pos == "BACK" then
  56.    sig = "back"
  57.    good()
  58.  else
  59.    print("wrong input try again")
  60.     sleep(3)
  61.     pass()
  62.     end
  63. end
  64.  
  65. function good()
  66.  
  67. term.clear()
  68. kuna2 = fs.open("strana", "w")
  69. kuna2.write(sig)
  70. kuna2.close()
  71.  
  72. term.setCursorPos(10, 10)
  73. print("EVERYTHING SAVED HAVE A NICE DAY")
  74. sleep(3)
  75. open()
  76. end
  77.  
  78. function open()
  79. term.clear()
  80. term.setCursorPos(10, 10)
  81. print("PLEASE ENTER THE PASSWORD:  ")
  82. term.setCursorPos(20, 11)
  83. getpass = read()
  84. if getpass == pas then
  85.    term.clear()
  86.   term.setCursorPos(10, 10)
  87.    print("ACESS GRANTED HAVE A NICE DAY")
  88.    redstone.setOutput(sig, true)
  89.    sleep(5)
  90.    rs.setOutput(sig, false)
  91.    open()
  92.  else
  93.   term.clear()
  94.   term.setCursorPos(10, 10)
  95.   print("PASSWORD INCORRECT TRY AGAIN")
  96.   sleep(3)
  97.   open()
  98.  end
  99. end
  100.  
  101. zacatek()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement