sethxi

SimplePCAuth

Jul 3rd, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. local password = "helicopter"
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. local function printWithFormat(...)
  6. local s = "&1"
  7. for k, v in ipairs(arg) do
  8. s = s .. v
  9. end
  10. s = s .. "&0"
  11.  
  12. local fields = {}
  13. local lastcolor, lastpos = "0", 0
  14. for pos, clr in s:gmatch"()&(%x)" do
  15. table.insert(fields, {s:sub(lastpos + 2, pos - 1), lastcolor})
  16. lastcolor, lastpos = clr , pos
  17. end
  18.  
  19. for i = 2, #fields do
  20. term.setTextColor(2 ^ (tonumber(fields[i][2], 16)))
  21. io.write(fields[i][1])
  22. end
  23. end
  24.  
  25. while true do
  26. term.clear()
  27. term.setCursorPos(1,1)
  28. printWithFormat("&3LiquidObsidian's Authenticator\n\n&2Enter Password: ")
  29. local input = read("*")
  30. if input == password then
  31. term.clear()
  32. term.setCursorPos(1,1)
  33. printWithFormat("&5Access Granted!\n")
  34. return
  35. else
  36. printWithFormat("&1Access Denied!")
  37. sleep(2)
  38. end
  39. end
Advertisement
Add Comment
Please, Sign In to add comment