Advertisement
Guest User

login2

a guest
May 31st, 2019
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.36 KB | None | 0 0
  1. local component=require("component")
  2.  
  3. local rs=component.redstone
  4.  
  5. local gpu=component.gpu
  6.  
  7. local term=require("term")
  8.  
  9. local text=require("text")
  10.  
  11. local computer=require("computer")
  12.  
  13. local os=require("os")
  14.  
  15. local sides = require("sides")
  16.  
  17. ----Config----
  18.  
  19. local delay1=1             --The delay what the redstone is on for (1)
  20.  
  21. local delay2=1             --The delay what the redstone is on for (2)
  22.  
  23. local side1=0              --The redstone side (1)
  24.  
  25. local side2=0              --The redstone side (2)
  26.  
  27. local username1="polis"     --Username (1)
  28.  
  29. local username2="holm"     --Username (2)
  30.  
  31. local password1="admin"     --Password (1)
  32.  
  33. local password2="admin"     --Password (2)
  34.  
  35. local commands1="start reactor 1"
  36. local commands2="stop reactor 1"
  37.  
  38. local commands3="start reactor 2"
  39. local commands4="stop reactor 2"
  40.  
  41. local commands5="start reactor 3"
  42. local commands6="stop reactor 3"
  43.  
  44. local commands7="start reactor 4"
  45. local commands8="stop reactor 4"
  46.  
  47. local firstmsg="BNK-SYSTEM AND PROTECTION SECURITY"      --The message that appears when the program is started
  48.  
  49. ---- ---- ----
  50.  
  51. while true do
  52.  
  53.     term.clear()
  54.  
  55.     gpu.set(1,1,firstmsg)
  56.  
  57.     term.setCursor(1,2)
  58.  
  59.     gpu.set(1,3,"Please enter the username:")
  60.  
  61.     term.setCursor(27,3)
  62.  
  63.     local username=io.read()
  64.  
  65.     if username==username1 then
  66.  
  67.          gpu.set(1,4,"Please enter the password:")
  68.  
  69.         term.setCursor(27,4)
  70.  
  71.    local password=io.read()
  72.  
  73.    if password==password1 then
  74.  
  75. end
  76.  
  77. while true do
  78.       term.clear()
  79.  
  80.       gpu.set(1,1,"BNK-SYSTEMS REACTOR CONTROL")
  81.  
  82.         gpu.set(1,3,"COMMANDS:")
  83.  
  84.           gpu.set(1,5,"start reactor <number>")
  85.           gpu.set(1,6,"stop reactor <number>")
  86.  
  87.        gpu.set(1,8,"ENTER COMMAND PLEASE:")
  88.  
  89.       term.setCursor(23,8)
  90.  
  91.       local command=io.read()
  92.  
  93.  
  94.      
  95.       if command==commands1 then --reactor 1 on
  96.  
  97.       rs.setOutput(sides.top,15)
  98.  
  99.  
  100.            
  101.  
  102.      
  103.      if command==commands2 then --reactor 1 off
  104.  
  105.       rs.setOutput(sides.top,0)
  106. end
  107.  
  108. else
  109.  
  110.     if username==username2 then
  111.  
  112.         gpu.set(1,4,"Please enter the password:")
  113.  
  114.         term.setCursor(27,4)
  115.  
  116.    local password = text.trim(term.read(nil, false, nil, "*"))
  117.  
  118. if password==password2 then
  119.  
  120.            --  rs.setOutput(sides.top,15)
  121.  
  122.            --  os.sleep(delay2)
  123.  
  124.            --  rs.setOutput(sides.top,15)
  125.  
  126. else
  127.  
  128. gpu.set(1,6,"Wrong username!")
  129.  
  130.     os.sleep(2)
  131.  
  132. end
  133. end
  134. end
  135. end
  136. end
  137. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement