Advertisement
Guest User

startup

a guest
Dec 21st, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.03 KB | None | 0 0
  1. local status = {"<Enter Card>","<Rejected>","<Granted>"}
  2. local current = 1
  3. local combo = "1004"
  4. local lastTimer
  5. local etat = 1
  6.  
  7. m = peripheral.wrap("left")
  8. m.clear()
  9. local function centerText(text)
  10.   x,y = m.getSize()
  11.   x1,y1 = m.getCursorPos()
  12.   m.setCursorPos((math.floor(x/2) - (math.floor(#text/2))), y1)
  13.   m.write(text)  
  14. end
  15.  
  16.  
  17.  
  18. while true do
  19. local event,arg1,arg2,arg3 = os.pullEvent()
  20. if event == "timer" and arg1 == lastTimer then
  21.   current = 1
  22.   lastTimer = nil
  23.   rs.setOutput("top",false)
  24.  
  25.  
  26.   if etat == 1 then
  27.     sleep(3)
  28.    --afficher image decompression
  29.    
  30.         m.setCursorPos(1,4)
  31.         centerText("AIR : 0 %")
  32.         m.setCursorPos(1, 7)
  33.    centerText("OXYGENE : 0 %")
  34.         m.setCursorPos(1, 10)
  35.    centerText("DECOMPRESSION : 0 %")
  36.         m.setCursorPos(1, 15)
  37.         centerText("TOTAL : 0 %")
  38.  
  39.         sleep(1)
  40.         m.setCursorPos(1, 4)
  41.         centerText("AIR : 25 %")
  42.         m.setCursorPos(1, 7)
  43.         centerText("OXYGENE : 25 %")
  44.         m.setCursorPos(1, 10)
  45.         centerText("DECOMPRESSION : 25 %")
  46.         m.setCursorPos(1, 15)
  47.         centerText("TOTAL : 25 %")
  48.  
  49.         sleep(1)
  50.         m.setCursorPos(1, 4)
  51.         centerText("AIR : 75 %")
  52.         m.setCursorPos(1, 7)
  53.         centerText("OXYGENE : 75 %")
  54.         m.setCursorPos(1, 10)
  55.         centerText("DECOMPRESSION : 75 %")
  56.         m.setCursorPos(1, 15)
  57.         centerText("TOTAL : 75 %")
  58.  
  59.         sleep(1)
  60.         m.setCursorPos(1, 4)
  61.         centerText("AIR : 100 %")
  62.         m.setCursorPos(1, 7)
  63.         centerText("OXYGENE : 100 %")
  64.         m.setCursorPos(1, 10)
  65.         centerText("DECOMPRESSION : 100 %")
  66.         m.setCursorPos(1, 15)
  67.         centerText("TOTAL : 100 %")
  68.  
  69.  
  70.         rs.setOutput("front",true)
  71.         sleep(5)
  72.         rs.setOutput("front",false)
  73.         m.clear()
  74.         os.reboot()
  75.   end
  76.  
  77.  
  78.   if etat == 2 then
  79.   sleep(2)
  80.  sensor=peripheral.wrap("back")
  81.         for _, name in pairs(sensor.getPlayerNames()) do
  82. local victime = name
  83.         m.setCursorPos(1, 6)
  84.         centerText("Mr " ..name)
  85.   m.setCursorPos(1, 7)
  86.   centerText(" vous n'êtes pas autoriser être ici")
  87.         m.setCursorPos(1, 8)
  88.         centerText("veuillez rester ici jusqu'un agent arrive")
  89.  
  90.   end
  91.   etat = 3
  92.   end
  93.  
  94.   if etat == 5 then
  95.   m.setCursorPos(1, 7)
  96.   m.clearLine()
  97.   m.setCursorPos(1, 8)
  98.   m.clearLine()
  99.      m.setCursorPos(1, 5)
  100.      centerText("Personne non autoriser :")
  101.   sleep(3)
  102.   m.clear()
  103.   etat = 4
  104.   lastTimer = os.startTimer(3)
  105.   rs.setOutput("top", true)
  106.  end
  107.  
  108.  if etat == 4 then
  109.   etat = 6
  110.   sleep(1)
  111.  end
  112.  
  113. elseif event == "mag_swipe" then
  114.   if arg1 == combo and etat == 1 then
  115.    lastTimer = os.startTimer(5)
  116.    current = 3
  117.    rs.setOutput("top",true)
  118.    etat = 1
  119.   end
  120.  
  121.   if arg1 ~= combo then
  122.    lastTimer = os.startTimer(5)
  123.    etat = 2
  124.  
  125.    rs.setOutput("top", true)
  126.   end
  127.  
  128.  if arg1 == combo and etat == 3 then
  129.   lastTimer = os.startTimer(3)
  130.   rs.setOutput("top", true)
  131.   etat = 5
  132.  end
  133.  
  134.   else
  135.    lastTimer = os.startTimer(5)
  136.    current = 2
  137.    etat = 4
  138.   end
  139. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement