Advertisement
Guest User

ATM

a guest
Jul 7th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.54 KB | None | 0 0
  1. --Themeing--
  2. function setpos1()
  3.   term.setCursorPos(6,4)
  4. end
  5.  
  6. function setpos2()
  7.   term.setCursorPos(6,6)
  8. end
  9.  
  10. function reset()
  11.   term.setCursorPos(6,4)
  12.   term.setTextColor(colors.white)
  13. end  
  14.  
  15. --Commandblock Commands--                        
  16. function withdraw_cmd()
  17.   if username == stored_username() then
  18.     commands.exec( "sudo pay @p[" .. amount .. "]")
  19.   else
  20.     print("You don't have permission to withdraw from this account")    
  21.   end
  22. end
  23.  
  24. --Authentication--
  25. function user_func()
  26.   local username = ""
  27.   term.setCursorPos(1,1)
  28.   term.write("Please enter your username")    
  29. end        
  30.  
  31.  
  32.  
  33. function login_func(loginread)
  34.   reset()
  35.   term.setCursorPos(10,4)
  36.   print("Login")
  37.   setpos2()
  38.   term.write("Username:")
  39.   login_input = read()
  40.   loginread = string.lower(login_input)
  41.   term.clear()
  42.   peripheral.wrap("right")
  43.   setpos1()
  44.   print("Please right click the peripheral")
  45.   local event, players = os.pullEvent( "player" )
  46.   term.clear()
  47.   if players == loginread then
  48.     term.setTextColor(colors.green)
  49.     setpos1()
  50.     textutils.slowPrint("Authentication accepted!")
  51.     sleep(2)
  52.     term.clear()
  53.     return loginread
  54.   else
  55.     term.clear()
  56.     setpos1()
  57.     term.setTextColor(colors.red)
  58.     textutils.slowPrint("Authentication denied.")
  59.     sleep(3)
  60.     term.clear()
  61.     login_func()
  62.   return loginread
  63.   end
  64. end  
  65.  
  66. --Reset balance--
  67.  
  68. --Create/Read balance accounts--
  69.  
  70.    
  71.            
  72. --[Read]--
  73.  
  74. login_func(loginread)
  75. print(loginread)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement