Guest User

too long without yielding

a guest
Nov 30th, 2012
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. yes=true
  2. no=false
  3. lock="lock"
  4. unlock="unlock"
  5. pass="admin"
  6. monstat=""
  7. Currentstate=""
  8. Logged = false
  9.  
  10. Lokit = function(bool,state,Cstate)
  11.  redstone.setOutput("back", bool)
  12.  redstone.setOutput("bottom", bool)
  13.  monstat = state
  14.  Currentstate = Cstate
  15. end
  16.  
  17. Lokit(yes,"Locked","Locked")
  18. mon = peripheral.wrap("top")
  19.  
  20. while true do
  21. mon.clear()
  22. mon.setCursorPos(1,1)
  23. mon.write(monstat)
  24. term.clear()
  25. term.setCursorPos(1,1)
  26.  if Logged then
  27.   print("Lockdown system activated!")
  28.   print("status: "..Currentstate)
  29.   input = read()
  30.   if input == lock then
  31.    Lokit(yes,"Locked","Locked")
  32.    print("Area now on Lockdown!")
  33.    sleep(1)
  34.   elseif input == unlock then
  35.    Lokit(no,"UNL","Unlocked")
  36.    write("Area Unlocked, watch your back!")
  37.    sleep(1)
  38.   elseif input == "logout" then Logged=false
  39.  end
  40.  if not Logged then
  41.   print ("Please enter the master password!")
  42.   input = read("*")
  43.   if input == pass then Logged = true
  44.   end
  45.  end
  46. end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment