Guest User

Untitled

a guest
Oct 17th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1.  
  2. user = user
  3. load1 = "[ ]"
  4. load2 = "[00 ]"
  5. load3 = "[0000 ]"
  6. load4 = "[000000]"
  7.  
  8.  
  9.  
  10.  
  11. os.pullEvent = os.pullEventRaw
  12.  
  13. PVar={_PVarPath="/vvSystem/"}
  14. setmetatable(PVar,PVar)
  15.  
  16. PVar._getVariablePath=function(name)
  17. local filepath = fs.combine(PVar["_PVarPath"],name..".var")
  18. if not fs.exists(PVar["_PVarPath"]) then
  19. fs.makeDir(PVar["_PVarPath"])
  20. end
  21. return filepath
  22. end
  23.  
  24. function PVar._assertOnInvalidName(name)
  25. if name:sub(1,1)=="_" then
  26. error("Variable names cannot start with _")
  27. else
  28. local invalidCharPos,_ = name:find("[:/\*|<>;%s]")
  29. if invalidCharPos then
  30. error("Variable names contains invalid character '"..name:sub(invalidCharPos,invalidCharPos).."'")
  31. end
  32. end
  33. end
  34.  
  35. function PVar.__index(tbl,name)
  36. PVar._assertOnInvalidName(name)
  37. local f = io.open(PVar._getVariablePath(name), "r")
  38. if f then
  39. local content = textutils.unserialize(f:read())
  40. f:close()
  41. return content
  42. else
  43. return nil
  44. end
  45. end
  46.  
  47. function PVar.__newindex(tbl,name,value)
  48. PVar._assertOnInvalidName(name)
  49. if value then
  50. local f = io.open(PVar._getVariablePath(name), "w")
  51. assert(f,"FAIL: could not open file")
  52. if f then
  53. f:write(textutils.serialize(value))
  54. f:close()
  55. end
  56. else
  57. fs.delete(PVar._getVariablePath(name))
  58. end
  59. end
  60.  
  61.  
  62. os.pullEvent = os.pullEventRaw
  63. function printFrameLogin()
  64. term.setCursorPos(1,1)
  65. shell.run("clear")
  66. print("+-----------------------------------------------+")
  67. print("|---00000 000 0000 -| |--|")
  68. print("|---00 00 00 00 -| |--|")
  69. print("|---0000 00 00 0000 -| |--|")
  70. print("|---00 00 00 00-| |--|")
  71. print("|---00000 000 0000 -| |--|")
  72. print("+-----------------------------------------------+")
  73. end
  74.  
  75. term.clear()
  76. term.setCursorPos(1,1)
  77. printFrameLogin()
  78. term.setCursorPos(26,2)
  79. Ehwhatpass = PVar.pass
  80. sleep(1)
  81. write("Username: ")
  82. user = read()
  83. term.setCursorPos(46,2)
  84. write("|--|")
  85. if user == PVar.user then
  86. term.setCursorPos(26,3)
  87. write("Password: ")
  88. p1 = read("*")
  89. term.setCursorPos(46,2)
  90. write("|--|")
  91. if p1 == Ehwhatpass then
  92. term.clear()
  93. term.setCursorPos(1,1)
  94. printFrameLogin()
  95. term.setCursorPos(26,3)
  96. write("Loading "..load1.."")
  97. sleep(1)
  98. term.clear()
  99. term.setCursorPos(1,1)
  100. printFrameLogin()
  101. term.setCursorPos(26,3)
  102. write("Loading "..load2.."")
  103. sleep(1)
  104. term.clear()
  105. term.setCursorPos(1,1)
  106. printFrameLogin()
  107. term.setCursorPos(26,3)
  108. write("Loading "..load3.."")
  109. sleep(1)
  110. term.clear()
  111. term.setCursorPos(1,1)
  112. printFrameLogin()
  113. term.setCursorPos(26,3)
  114. write("Loading "..load4.."")
  115. sleep(1)
  116. shell.run("gui1")
  117. else
  118. term.setCursorPos(26,4)
  119. print("Password Incorrect!")
  120. sleep(2)
  121. os.shutdown()
  122. end
  123. else
  124. term.setCursorPos(26,3)
  125. print("Username Incorrect!")
  126. sleep(2)
  127. os.shutdown()
  128. end
Add Comment
Please, Sign In to add comment