Advertisement
Guest User

Untitled

a guest
Sep 11th, 2019
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.01 KB | None | 0 0
  1. if not fs.exists("password.txt") then
  2.     write("Please enter your password. You must ask Nathan if you wish to change it: ")
  3.     status,newpwd = pcall(read)
  4.     file = fs.open("password.txt","w")
  5.     file.writeLine(newpwd)
  6.     file.close()
  7. end
  8.  
  9. pwdfile = fs.open("password.txt","r")
  10. password = pwdfile.readLine()
  11. pwdfile.close()
  12.  
  13. while true do
  14.     term.clear()
  15.     term.setCursorPos(1,1)
  16.     write("Enter Password: ")
  17.     status,pwd=pcall(read)
  18.     if pwd == password then
  19.         term.clear()
  20.         print("Password Accepted!")
  21.         redstone.setOutput("left",true)
  22.         for i=0,5 do
  23.             x,y = term.getCursorPos()
  24.             term.clearLine()
  25.             term.setCursorPos(1,y)
  26.             write("You have "..(5-i).." seconds left")
  27.             pcall(sleep,1)
  28.         end
  29.     elseif pwd == "adminmode" then
  30.         term.clear()
  31.         sleep(5)
  32.     else
  33.         print("Password not accepted")
  34.         pcall(sleep,5)
  35.     end
  36.     write("\n")
  37.     redstone.setOutput("left",false)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement