Advertisement
Guest User

startup

a guest
Jul 19th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | None | 0 0
  1. conSide = "back"
  2. icbmSide = "bottom"
  3. protocol = "iTnP"
  4.   computerId = os.getComputerID()
  5.  
  6. rednet.open(conSide)
  7.  
  8. term.clear()
  9. term.setCursorPos(1, 1)
  10.  
  11. if not rednet.isOpen(conSide) then
  12.   print("Erro ao estabelecer conexao a rede Skynet.")
  13.   sleep(3)
  14.   os.reboot()
  15. end
  16.  
  17. print("Conexao com Sistemas Skynet .. OK")
  18. print("Aguardando log in.")
  19. sleep(2)
  20.  
  21. term.clear()
  22. x,y = term.getSize()
  23. term.setCursorPos(x/2 - 17, y/2 - 1)
  24. print("Username: ")
  25. term.setCursorPos(x/2 - 15, y/2)
  26. user = read()
  27. term.setCursorPos(x/2 - 17, y/2 + 1)
  28. print("Password: ")
  29. term.setCursorPos(x/2 - 15, y/2 + 2)
  30. pass = read("*")
  31. authString = "R.Check." .. user .. "." .. pass
  32. term.clear()
  33. term.setCursorPos(1, 1)
  34.  
  35. function menu()
  36.   term.clear()
  37.   x,y = term.getSize()
  38.   term.setCursorPos(x/2 - 20, y/2)
  39.   print("[1] Lancar [2] Sair")
  40.   term.setCursorPos(x/2 - 10, y/2 + 1)
  41.   c = read()
  42.   if c == "1" then
  43.     term.clear()
  44.     term.setCursorPos(x/2 - 10, y/2)
  45.     sleep(20)
  46.     print("A Lancar Missil...")
  47.     redstone.setOutput(icbmSide, true)
  48.     term.setCursorPos(x/2 - 10, y/2 + 1)
  49.     print("Missil Lancado.....")
  50.     sleep(5)
  51.     redstone.setOutput(icbmSide, false)
  52.     menu()
  53.     return
  54.   elseif c == "2" then
  55.     os.reboot()
  56.   end
  57. end
  58.  
  59. while true do
  60.  
  61.   rednet.broadcast("R.Id", protocol)
  62.   i1,m1,p1 = rednet.receive()
  63.   if i1 == m1 and p1 == protocol then
  64.     rednet.send(i1, authString, protocol)
  65.     i2,m2,p2 = rednet.receive()
  66.     if i2 == i1 and p2 == protocol then
  67.       if m2 == "Resp.True" then
  68.         menu()
  69.         break
  70.       else
  71.         print("Dados Invalidos.")
  72.         sleep(2)
  73.         os.reboot()
  74.       end
  75.     else
  76.       os.reboot()
  77.     end
  78.   else
  79.     os.reboot()
  80.   end
  81.  
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement