Advertisement
Guest User

test2

a guest
Feb 15th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. function clear()
  2.   term.clear()
  3.   term.setCursorPos(1,1)
  4.   print("Potato Inc. Mainframe v1.3\n")
  5. end
  6. function login()
  7.   clear()
  8.  
  9.   print("Please Login.")
  10.   write("  Username: ")
  11.     x = read()
  12.   write("  Password: ")
  13.     y = read("*")
  14.   if x == "Jacob" and y == "test" then
  15.     clear()
  16.     print("Welcome " .. x)
  17.     sleep(1)
  18.     clear()
  19.     command()
  20.   else
  21.     sleep(1)
  22.     login()
  23.   end
  24. end
  25.  
  26. function command()
  27.   rednet.open("back")
  28.  
  29.   write(x .. ": ")
  30.   z = read()
  31.  
  32.   if z == "open" then
  33.     open()
  34.   elseif z == "close" then
  35.    rednet.send(8, "close")
  36.   elseif z == "exit" then
  37.     error()
  38.   elseif z == "logout" then
  39.     login()
  40.   else
  41.     print("Unknown Command")
  42.     command()
  43.   end
  44. end
  45.  
  46. function open()
  47.   print("Which door would you like to open?")
  48.   write(x .. ": ")
  49.   op = read()
  50.   if op == "1" then
  51.     rednet.send(8, "open")
  52.   elseif op == "exit" then
  53.     command()
  54.   else
  55.     print("Unknown Door")
  56.     open()
  57.   end
  58.   print("Door " .. op .. " was opened")
  59. end  
  60. login()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement