Advertisement
the_lad

diskLogin

Apr 7th, 2023 (edited)
678
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.pullEvent = os.pullEventRaw
  2. --Server var
  3. server = 1
  4.  
  5. --functions
  6.  
  7. function clear()
  8.   term.clear()
  9.   term.setCursorPos(1,1)
  10.   term.setTextColor(colors.red)
  11.   print("NEOTERRA FOUNDATION")
  12.   term.setTextColor(colors.white)
  13.   print("Connected to: ".."[Redacted]")
  14. end
  15.  
  16. function Start()
  17.   clear()
  18.   term.setCursorPos(1,1)
  19.   local event, side = os.pullEvent("disk")
  20.   print("reading drive...")
  21.    if disk.isPresent("bottom") == true then
  22.         print("reading card")
  23.         if fs.exists("disk/.uid") == false then
  24.             print("drive is not an access card")
  25.             sleep(1)
  26.             Start()
  27.         end
  28.         rednet.send(server, fs.open("disk/.uid", "r").readAll(), "UID")
  29.         rednet.send(server, fs.open("disk/.uname", "r").readAll(), "username")
  30.         rednet.send(server, fs.open("disk/.upass", "r").readAll(), "password")
  31.         local server,message,protocol = rednet.receive("response",3)
  32.         if message == "confirm" then
  33.             disk.eject("bottom")
  34.             Task()
  35.             Start()
  36.         else
  37.             print("Rejected")
  38.             Start()
  39.         end
  40.     end
  41. end
  42.  
  43. function Task()
  44.   redstone.setOutput("left", true)
  45.   sleep(2)
  46.   redstone.setOutput("left",false)
  47.   Start()
  48. end
  49.  
  50. Start()
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement