Guest User

Untitled

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