123pandaman

Computer Craft - ATM - OpenAccount

Mar 22nd, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local startingMoney = 1000
  2.  
  3. shell.run("clear")
  4. print("Please enter a username to continue:")
  5. repeat
  6.     term.write(">")
  7.     wantedUsername = read()
  8.     if(fs.exists(wantedUsername)) then
  9.         print("That username is unavalible, please enter a valid one:")
  10.         wantedUsername = nil
  11.     end
  12. until wantedUsername ~= nil
  13. local userFile = fs.open(wantedUsername, "w")
  14. print("Please enter a password:")
  15. term.write(">")
  16. local password = read("*")
  17. userFile.writeLine(password .. " " .. startingMoney)
  18. userFile.close()
Add Comment
Please, Sign In to add comment