Advertisement
Guest User

startup

a guest
Aug 1st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.99 KB | None | 0 0
  1. rednet.open("back")
  2. os.sleep(1)
  3. errorreport = false
  4. if errorreport==false then
  5.   redstone.setOutput("top", true)
  6.   term.setTextColor(8)
  7.   local version = os.version()
  8.   print("This is Computer #8")
  9.   term.setTextColor(8)
  10.   print("This computer's operating system is MarOS 1.4.7")
  11.   function start()
  12.   rednet.send(1, "auth")
  13.   --i = 0
  14.   --repeat
  15.   local event, senderId, message, distance = os.pullEvent("rednet_message")
  16.   --repeat
  17.   if senderId==1 then
  18.     userinfo = {}
  19.     userinfo = message
  20.     username = userinfo[1]
  21.     authLevel = userinfo[2]
  22.     --print(username)
  23.     --print(authLevel)
  24.     cont()
  25.    
  26.   --local event, senderId, message, distance = os.pullEvent("rednet_message")
  27.   --if senderId==1 then
  28.      --local authLevel = message
  29.   --end
  30.   end
  31.   end
  32.   --until authLevel==0 or authLevel==1 or authLevel==2 or authLevel==3 or authLevel==4 or authLevel==5 or i==10
  33.   function cont()
  34.   term.setTextColor(2)
  35.   if version=="CraftOS 1.5" then
  36.     print("This Terminal is out of date. Please contact your system administrator to resolve this issue.")
  37.     os.run("logout")
  38.   elseif version=="CraftOS 1.6" and authLevel==1 then
  39.     shell.run("LevelOne", username)
  40.   elseif version=="CraftOS 1.6" and authLevel==2 then
  41.     shell.run("LevelTwo", username)
  42.   elseif version=="CraftOS 1.6" and authLevel==3 then
  43.     shell.run("LevelThree", username)
  44.   elseif version=="CraftOS 1.6" and authLevel==4 then
  45.     shell.run("LevelFour", username)
  46.   elseif version=="CraftOS 1.6" and authLevel==5 then
  47.     shell.run("LevelFive", username)
  48.   elseif version=="CraftOS 1.6" and authLevel==0 then
  49.     print("This Terminal is up to date.")
  50.     print("Please press a key to select a command")
  51.     term.setTextColor(1)
  52.     print("1) Log in")
  53.     print("2) Log out")
  54.     print("3) Help")
  55.     term.setTextColor(2)
  56.     local event, key = os.pullEvent("key")
  57.     if key == keys.one then
  58.       local password = {}
  59.       print("Please enter your password")
  60.       local event, key = os.pullEvent("key")
  61.       password[1] = key - 1
  62.       local event, key = os.pullEvent("key")
  63.       password[2] = key - 1
  64.       local event, key = os.pullEvent("key")
  65.       password[3] = key - 1
  66.       local event, key = os.pullEvent("key")
  67.       password[4] = key - 1
  68.       term.setTextColor(2)
  69.       print("Authenticating...")
  70.       rednet.send(1, "password")
  71.       os.sleep(.1)
  72.       rednet.send(1, password)
  73.       os.shutdown()
  74.     elseif key==keys.two then
  75.       rednet.broadcast("logout")
  76.       print("System Shutdown Initiated")
  77.       os.sleep(10)
  78.       print("System Shutdown Complete")
  79.       os.reboot()  
  80.     elseif key==keys.three then
  81.       local event, key = os.pullEvent("key")
  82.       if key==keys.t then
  83.         shell.run("edit", "startup")
  84.       else
  85.         os.sleep(3)
  86.         os.reboot()
  87.       end
  88.     else
  89.       os.reboot()
  90.     end    
  91. else
  92.   redstone.setOutput("top", false)
  93.   rednet.open("back")
  94.   rednet.broadcast("Help, I'm Broken!")
  95.   rednet.close("back")
  96. end
  97. end
  98. end
  99. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement