pepeknamornik

AccountCreator

Jun 17th, 2021 (edited)
2,287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.87 KB | None | 0 0
  1. local w,h = term.getSize()
  2. if fs.exists("/C/system/.core/system") then
  3.     local data = fs.open ("/C/system/.core/system", "r")
  4.     edice = data.readLine()
  5.     data.close()
  6. else
  7.     edice = "Standard"
  8. end
  9. if (edice == "Server") then ServerMode = true end
  10.  
  11. local function prc(text, y)
  12.   local w = term.getSize()
  13.   local _, cy = term.getCursorPos()
  14.   curs(math.ceil((w-#text)/2), y or cy)
  15.   write(text)
  16. end
  17.  
  18. function pozadi()
  19.  
  20. local myWindow = window.create(term.current(),1,1,12,h)
  21. myWindow.setBackgroundColor(colors.blue)
  22. myWindow.clear()
  23.  
  24. myWindow.setCursorPos(2,5)
  25. myWindow.setTextColor(colors.white)
  26. myWindow.write("- Edition")
  27. myWindow.setCursorPos(2,7)
  28. myWindow.setTextColor(colors.white)
  29. myWindow.write("- Install")
  30. myWindow.setCursorPos(2,9)
  31. myWindow.setTextColor(colors.white)
  32. myWindow.write("- Network")
  33. myWindow.setCursorPos(2,11)
  34. myWindow.setTextColor(colors.lightGray)
  35. myWindow.write("- Account")
  36. myWindow.setCursorPos(2,h)
  37. myWindow.setTextColor(colors.white)
  38. myWindow.write("Pepek@Soft")
  39.  
  40. plocha = window.create(term.current(),13,1,w-12,h)
  41. ww = w-12
  42. plocha.setBackgroundColor(colors.white)
  43. plocha.clear()
  44. plocha.setTextColor(colors.black)
  45. plocha.setCursorPos(ww/2-12,1) 
  46. plocha.write("Pepdroll Seven Installer")
  47.  
  48. plocha.setBackgroundColor(colors.lightGray)
  49. plocha.setCursorPos(ww/2-4,h-1)
  50. plocha.write" Next "
  51. plocha.setBackgroundColor(colors.white)
  52. plocha.setTextColor(colors.black)
  53. end
  54.  
  55. function dokoncit()
  56.             plocha.setBackgroundColor(colors.gray)
  57.             plocha.setCursorPos(ww/2-4,h-1)
  58.             plocha.write" Done "
  59.             sleep(0.1)
  60.             if not (nUser == "") then
  61.                 if (cPass == nPass) then
  62.                     local o=fs.open ("/C/system/Users/"..nUser.."/.data", "w")
  63.                     o.writeLine(nUser)
  64.                     o.writeLine(nPass)
  65.                     o.writeLine("")
  66.                     o.writeLine("")
  67.                     o.writeLine("t")
  68.                     o.writeLine("t")
  69.                     o.close()
  70.                     o=fs.open ("/C/system/.core/defuser", "w")
  71.                     o.writeLine(nUser)
  72.                     o.close()
  73.                     local ucet = fs.open("/C/system/.core/ucet","w")
  74.                     ucet.close()
  75.                     if ServerMode then
  76.                         local data = fs.open("/C/system/Users/"..nUser.."/.Registry/colors", "w")
  77.                         data.writeLine("256")
  78.                         data.writeLine("32768")
  79.                         data.close ()
  80.                         local data = fs.open("/C/system/Users/"..nUser.."/.Registry/.showItem", "w") data.close()
  81.                     else
  82.                         local data = fs.open("/C/system/Users/"..nUser.."/.Registry/colors", "w")
  83.                         data.writeLine("2048")
  84.                         data.writeLine("1")
  85.                         data.close ()
  86.                     end
  87.                     local data = fs.open("/C/system/RAM/NewUser", "w") data.writeLine(nUser) data.close()
  88.                     data = fs.open("/C/system/Users/"..nUser.."/Desktop/This PC.src", "w") data.close()
  89.                     data = fs.open("/C/system/Users/"..nUser.."/.Registry/.disableAnim", "w") data.close()
  90.                 end
  91.             end
  92. end
  93.  
  94. function account()
  95. pozadi()
  96. if nUser == nil then
  97.     if ServerMode then
  98.     nUser = "Administrator"
  99.     else
  100.     nUser = "User"
  101.     end
  102. end
  103. plocha.setBackgroundColor(colors.lightGray)
  104. plocha.setCursorPos(ww/2-4,h-1)
  105. plocha.write" Done "
  106. plocha.setCursorPos(18,8)
  107. plocha.write"               "
  108. plocha.setCursorPos(19,8)
  109. plocha.write(nUser)
  110. plocha.setCursorPos(18,10)
  111. plocha.write"               "
  112. if not (nPass == "") then plocha.setCursorPos(19,10) plocha.write("Password") end
  113. plocha.setCursorPos(18,12)
  114. plocha.write"               "
  115. if (cPass == nPass) then
  116. plocha.setTextColor(colors.lime)
  117. plocha.setCursorPos(19,12)
  118. plocha.write("Same")
  119. else
  120. plocha.setTextColor(colors.red)
  121. plocha.setCursorPos(19,12)
  122. plocha.write("Different")
  123. end
  124. plocha.setTextColor(colors.black)
  125. plocha.setBackgroundColor(colors.white)
  126. plocha.setCursorPos(7,4)
  127. plocha.write" Create your first Account "
  128.  
  129. plocha.setCursorPos(8,8)
  130. plocha.write"Username:"
  131. plocha.setCursorPos(8,10)
  132. plocha.write"Password:"
  133. plocha.setCursorPos(8,12)
  134. plocha.write"Password:"
  135. term.setBackgroundColor(colors.lightBlue)
  136.  
  137.     while true do
  138.         event, button, x,y = os.pullEvent()
  139.        
  140.         if event == "mouse_click" and x >= 30 and x<= 44 and y == 8 and button == 1 then
  141.         plocha.setBackgroundColor(colors.lightBlue)
  142.         plocha.setCursorPos(18,8)
  143.         plocha.write"               "
  144.         plocha.setCursorPos(19,8)
  145.         nUser = read()
  146.         elseif event == "mouse_click" and x >= 30 and x<= 44 and y == 10 and button == 1 then
  147.         plocha.setBackgroundColor(colors.lightBlue)
  148.         plocha.setCursorPos(18,10)
  149.         plocha.write"               "
  150.         plocha.setCursorPos(19,10)
  151.         nPass = read(string.char(7))
  152.         elseif event == "mouse_click" and x >= 30 and x<= 44 and y == 12 and button == 1 then
  153.         plocha.setBackgroundColor(colors.lightBlue)
  154.         plocha.setCursorPos(18,12)
  155.         plocha.write"               "
  156.         plocha.setCursorPos(19,12)
  157.         cPass = read(string.char(7))
  158.         term.setCursorPos(w/2, h-2)
  159.         elseif event == "mouse_click" and x >= (w/2)+2 and x<= (w/2)+7 and y == h-1 and button == 1 then dokoncit() return
  160.         elseif event == "key" and (button == keys.enter or button == keys.numEnter) then dokoncit() return
  161.         end
  162.     end
  163. end
Add Comment
Please, Sign In to add comment