Advertisement
Guest User

GUI

a guest
Feb 6th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.08 KB | None | 0 0
  1. -- Draw Boarder function
  2. function DrawBoarder()
  3.   paintutils.drawLine(1, 1, 51, 1, colors.green)
  4.   paintutils.drawLine(1, 2, 1, 18, colours.green)
  5.   paintutils.drawLine(1, 18, 51, 18, colours.green)
  6.   paintutils.drawLine(51, 2, 51, 18, colors.green)
  7.   CheckIfLoggedIn()
  8. end
  9.  
  10. function CS()
  11.   term.clear()
  12.   term.setTextColor(colors.white)
  13.   DrawBoarder()
  14. end
  15.  
  16. -- Login stuff
  17. Nitrosis = {"Nitrosis", "Rain"}
  18. Rain = {"Rain", "Nitro"}
  19.  
  20. -- Vars
  21. IsLoggedIn = false
  22.  
  23. -- Check is logged in
  24. function CheckIfLoggedIn()
  25.   if IsLoggedIn == false then
  26.     term.setCursorPos(20, 3)
  27.     term.setBackgroundColor(colors.black)
  28.     print("Please login.")
  29.     Login()
  30.   end
  31. end
  32.  
  33. function Login()
  34.   term.setTextColor(colours.white)
  35.   term.setCursorPos(3, 5)
  36.   print("Username: ")
  37.   term.setCursorPos(3, 6)
  38.   Username = read()
  39.   term.setCursorPos(3, 7)
  40.   print("Password: ")
  41.   term.setCursorPos(3, 8)
  42.   Password = read("*")
  43.   CheckLogin()
  44. end
  45.  
  46. function CheckLogin()
  47.   if Username == Nitrosis[1] and Password == Nitrosis[2] then
  48.     term.setCursorPos(18, 8)
  49.     term.setTextColor(colors.green)
  50.     print("Login successful")
  51.     IsLoggedIn = true
  52.     sleep(1)
  53.     GUI()
  54.   elseif Username == Rain[1] and Password == Rain[2] then
  55.     term.setCursorPos(18, 8)
  56.     term.setTextColor(colors.green)
  57.     print("Login successful")
  58.     IsLoggedIn = true
  59.     sleep(1)
  60.     GUI()
  61.   else
  62.     term.setCursorPos(20, 8)
  63.     term.setTextColor(colors.red)
  64.     print("Login failed")
  65.     sleep(1)
  66.     CS()
  67.   end
  68. end
  69.  
  70. function GUI()
  71.   term.clear()
  72.   paintutils.drawLine(1, 1, 51, 1, colors.green)
  73.   paintutils.drawLine(1, 2, 1, 18, colours.green)
  74.   paintutils.drawLine(1, 18, 51, 18, colours.green)
  75.   paintutils.drawLine(51, 2, 51, 18, colors.green)
  76.   term.setBackgroundColor(colors.black)
  77.   term.setTextColor(colors.white)
  78.   term.setCursorPos(15, 3)
  79.   print("Welcome back, ", Username)
  80.   term.setCursorPos(43, 16)
  81.   term.setBackgroundColor(colors.gray)
  82.   print("Logout")
  83.   CheckCursor()
  84. end
  85.  
  86. function CheckCursor()
  87.   while true do
  88.    
  89.   end
  90. end
  91.  
  92.  
  93.  
  94. -- Exec functions
  95. CS()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement