Advertisement
Guest User

create

a guest
Jan 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.31 KB | None | 0 0
  1. local function user()
  2.   local user = read()
  3.   return user
  4. end
  5. local function drawBox()
  6.   if term.isColor() then
  7.     paintutils.drawBox(2,10,49,12,colors.red)
  8.     paintutils.drawLine(3,11,48,11,colors.white)
  9.   else
  10.     basic.drawBox(2,10,49,12)
  11.   end
  12.   term.setCursorPos(3,11)
  13. end
  14. local function pass(key)
  15.   while true do
  16.     drawBox()
  17.     local pass = read(key)
  18.     if term.isColor() then
  19.       term.setBackgroundColor(colors.orange)
  20.       term.setTextColor(colors.black)
  21.     end
  22.     term.clear()
  23.     ks.center("Please confirm your password",9)
  24.     drawBox()
  25.     local CPass = read(key)
  26.     if CPass == pass then
  27.       break
  28.     else
  29.       term.setBackgroundColor(colors.orange)
  30.       term.clear()
  31.       ks.center("Those don't match! Let's try again!",true)
  32.     end
  33.   end
  34. end
  35. local function main()
  36.   if term.isColor() then
  37.     term.setBackgroundColor(colors.orange)
  38.     term.setTextColor(colors.black)
  39.   end
  40.   term.clear()
  41.   ks.center("Hello!",true)
  42.   sleep(0.7)
  43.   term.clear()
  44.   ks.center("You don't have an account, it seems!",true)
  45.   sleep(0.8)
  46.   term.clear()
  47.   ks.center("Shall we fix that?",true)
  48.   sleep(0.7)
  49.   term.clear()
  50.   ks.center("That was a rhetorical question. I'm gonna do it",true)
  51.   ks.center("anyway",10,true)
  52.   sleep(1)
  53.   term.clear()
  54.   ks.center("Firstly, let's get your username!",true)
  55.   drawBox()
  56.   local userst = user()
  57.   local user = userst
  58.   local passKey = "\7"
  59.   if userst == "Hydrotronics" then
  60.     user = "Hydro"
  61.   elseif userst == "Momboggins" then
  62.     user = "Momo"
  63.     passKey = "\3"
  64.   end
  65.   if term.isColor() then
  66.     term.setBackgroundColor(colors.orange)
  67.   end
  68.   term.clear()
  69.   ks.center("Cool name, "..user.."!",true)
  70.   sleep(0.6)
  71.   term.clear()
  72.   ks.center("Now, for your password!",true)
  73.   drawBox()
  74.   local pass = pass(passKey)
  75.   if term.isColor() then
  76.     term.setBackgroundColor(colors.orange)
  77.   end
  78.   term.clear()
  79.   ks.center("Brilliant! You now have an account!",true)
  80.   sleep(0.8)
  81.   term.clear()
  82.   ks.center("I shall now generate your account!",true)
  83.   term.setCursorPos(1,11)
  84.   print("Loading file..")
  85.   local file = fs.open("FireOS/32/User","w")
  86.   print("Injecting data..")
  87.   file.writeLine(user)
  88.   file.writeLine(pass)
  89.   print("Closing file..")
  90.   file.close()
  91.   print("Rebooting..")
  92.   sleep(0.2)
  93.   os.reboot()
  94. end
  95. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement