Advertisement
Guest User

startup

a guest
Oct 18th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1.  
  2. os.loadAPI("loginutils")
  3. os.loadAPI("textutils2")
  4.  
  5. loginutils.setPW("developer")
  6. local loginpw = "developer"
  7.  
  8. function loginmask()
  9. os.pullEvent = loginutils.secureMode
  10.  
  11. textutils2.clear()
  12. textutils2.writeCenterX("---------------",3)
  13. textutils2.writeCenterX("-Please Login:-",4)
  14. textutils2.writeCenterX("---------------",5)
  15. print("")
  16. local pw = loginutils.read("")
  17.  
  18. if pw ~= loginpw then
  19.   print("Wrong password.")
  20.   loginutils.sleep(2)  
  21.   os.reboot()
  22. end
  23.  
  24. textutils2.clear()
  25. textutils2.writeCenterX("Willkommen.", 4)
  26. textutils2.writeCenterX("anghenOS 0.1", 5)
  27. loginutils.sleep(2)
  28. textutils2.clear()
  29. end
  30.  
  31. function commandHandler()
  32.   write(">")
  33.   cmd = loginutils.read()
  34.   local args = {}
  35.   local count = 0
  36.   for i in string.gmatch(cmd, "%S+") do
  37.     args[count] = i
  38.     count = count+1
  39.   end
  40.   if args[0] == "devmode" then
  41.     loginutils.restore()
  42.     error("Devmode activated")
  43.   end
  44. end
  45.  
  46. loginmask()
  47. local ended = false
  48.  
  49. while ended == false do
  50.   commandHandler()
  51. end
  52. loginutils.restore()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement