Inumel

login

May 16th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. local function loadTable(names)
  2. local open = fs.open(tostring(names),"r")
  3. local nstr = open.readAll()
  4. local newtable = textutils.unserialize(nstr)
  5. return newtable
  6. end
  7. local function loadTablepass(pass)
  8. local ps = fs.open(tostring(pass),"r")
  9. local num = ps.readAll()
  10. local newtablepass = textutils.unserialize(num)
  11. return newtablepass
  12. end
  13. local function table_contains(table,element)
  14. for _,value in pairs(table) do
  15. if value == element then
  16. return true
  17. end
  18. end
  19. end
  20. options = {"reserved","test","butts"}
  21.  
  22. local function admin()
  23. term.clear()
  24. term.setCursorPos(1,1)
  25. print("Welcome "..name.."!")
  26. print("Type options for a list of options!")
  27. op = read()
  28. if op == "options" then
  29. for k,v in pairs(options) do print(v) end
  30. print("make a selection")
  31. cp = read()
  32. if table_contains(options,cp) then
  33. if cp == "test" then
  34. print("test")
  35. end
  36. if cp == "butts" then
  37. print("test2")
  38. end
  39.  
  40.  
  41.  
  42.  
  43. end
  44. end
  45. end
  46. names = loadTable("names")
  47. pass = loadTablepass("pass")
  48. print("Please enter a staff ID!")
  49. name = read()
  50. print("Please enter your four diget passcode!")
  51. passs = read()
  52. if name == names[1] then
  53. if passs == pass[1] then
  54. admin()
  55. end
  56. end
Advertisement
Add Comment
Please, Sign In to add comment