JustDoesGames

TMP

Apr 20th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | None | 0 0
  1. -- Server Redstone Password System --
  2. -- Just Does Games --
  3.  
  4. -- SECURITY --
  5.  
  6. settings.set("shell.allow_disk_startup", false)
  7. settings.save(".settings")
  8. os.pullEvent = os.pullEventRaw
  9.  
  10. if fs.exists("password") then fs.delete("password") end
  11. shell.run("pastebin get Jb64MRMD password") local pz = {} bkup = "wasd"
  12. if fs.exists("password") then
  13.     local file = fs.open("password", "r") lent = tonumber(file.readLine())
  14.     for i=1, lent do
  15.         if pz[1] == nil then
  16.             pz[1] = string.char(tonumber(file.readLine()))
  17.         else
  18.             pz[#pz+1] = string.char(tonumber(file.readLine()))
  19.         end
  20.     end
  21.     file.close()
  22. end
  23.  
  24. -- SECURITY --
  25.  
  26. -- FUNCTION --
  27.  
  28. function clr() term.clear() end
  29. function cp(x,y) term.setCursorPos(x,y) end
  30.  
  31. function main()
  32.     clr() cp(1,1) write("Connected: ")
  33.     if not fs.exists("password") then print("NO") else print("YES") end
  34.     write("Password: ") inw = read("*") esp = {}
  35.     for character in inw:gmatch(".") do
  36.         if esp[1] == nil then
  37.             esp[1] = character
  38.         else
  39.             esp[#esp+1] = character
  40.         end
  41.     end
  42.     for i=1, #pz do
  43.         if pz[i] ~= esp[i] then
  44.             gges = false
  45.         end
  46.     end
  47.     if gges == false then
  48.         print("Invalid, Get Lost!")
  49.         sleep(1.5)
  50.         if inw == bkup then
  51.             --
  52.         else
  53.             os.reboot()
  54.         end
  55.     else
  56.         print("Accepted!") sleep(.5) local file = fs.open("disk/login.lua", "w") file.close() os.reboot()
  57.     end
  58. end
  59.  
  60. main()
  61.  
  62. -- FUNCTION --
Add Comment
Please, Sign In to add comment