Guest User

startup

a guest
Jul 19th, 2016
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.14 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.   icbm = peripheral.wrap(icbmSide)
  37.   term.clear()
  38.   x,y = term.getSize()
  39.   term.setCursorPos(x/2 - 20, y/2)
  40.   print("[1] Inserir Coords [2] Lancar [3] Sair")
  41.   term.setCursorPos(x/2 - 10, y/2 + 1)
  42.   c = read()
  43.   if c == "1" then
  44.     term.clear()
  45.     term.setCursorPos(x/2 - 5, y/2 - 1)
  46.     print("X:")
  47.     term.setCursorPos(x/2 - 3, y/2 - 1)
  48.     xc = read()
  49.     term.setCursorPos(x/2 - 5, y/2)
  50.     print("Y:")
  51.     term.setCursorPos(x/2 - 3, y/2)
  52.     yc = read()
  53.     term.setCursorPos(x/2 - 5, y/2 + 1)
  54.     print("Z:")
  55.     term.setCursorPos(x/2 - 3, y/2 + 1)
  56.     zc = read()
  57.     icbm.setTarget(xc,yc,zc)
  58.     menu()
  59.     return
  60.   elseif c == "2" then
  61.     term.clear()
  62.     term.setCursorPos(x/2 - 10, y/2)
  63.     print("A Lancar Missil...")
  64.     icbm.launch()
  65.     term.setCursorPos(x/2 - 10, y/2 + 1)
  66.     print("Missil Lancado.....")
  67.     menu()
  68.     return
  69.   elseif c == "3" then
  70.     os.reboot()
  71.   end
  72. end
  73.  
  74. while true do
  75.  
  76.   rednet.broadcast("R.Id", protocol)
  77.   i1,m1,p1 = rednet.receive()
  78.   print(i1)
  79.   if i1 == m1 and p1 == protocol then
  80.     rednet.send(i1, authString, protocol)
  81.     i2,m2,p2 = rednet.receive()
  82.     if i2 == i1 and p2 == protocol then
  83.       if m2 == "Resp.True" then
  84.         print("ok")
  85.         menu()
  86.         break
  87.       else
  88.         print("Dados Invalidos.")
  89.         sleep(2)
  90.         os.reboot()
  91.       end
  92.     else
  93.       os.reboot()
  94.     end
  95.   else
  96.     os.reboot()
  97.   end
  98.  
  99. end
Add Comment
Please, Sign In to add comment