Vincent38190

OutputSystem

May 21st, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.37 KB | None | 0 0
  1. if not fs.exists("/Fsociety/data/side") then
  2. print("ERROR NO SIDE FILE")
  3. os.reboot()
  4. end
  5. sideFile = fs.open("/Fsociety/data/side","r")
  6. modemSide = sideFile.readLine()
  7. NotAllowed = sideFile.readLine()
  8. Allowed = sideFile.readLine()
  9. sideFile.close()
  10.  
  11. --------------------------------------------
  12. --                                        --
  13. --            Output System from          --
  14. --            Security System V0.1        --
  15. --            By Fsociety                 --
  16. --                                        --
  17. --------------------------------------------
  18.  
  19. local m = peripheral.wrap(modemSide)
  20. m.open(101)
  21. local key = nil
  22. rs.setOutput(NotAllowed,true)
  23. while true do
  24.   local event , param1 , param2 , param3 , param4 = os.pullEvent()
  25.   m.transmit(100,100,param4)
  26.   if event == "modem_message" then
  27.     if param3 == 55 and param4 == "User allowed" then
  28.       rs.setOutput(Allowed,true)
  29.       rs.setOutput(NotAllowed,false)
  30.     elseif param3 == 55 and param4 ~= "User allowed" then
  31.       rs.setOutput(Allowed,false)
  32.       rs.setOutput(NotAllowed,true)
  33.     elseif param3 ~= 55 then
  34.       while true do
  35.         rs.setOutput(NotAllowed,false)
  36.         sleep(0.5)
  37.         rs.setOutput(NotAllowed,true)
  38.         sleep(0.5)
  39.         term.setTextColor(colors.red)
  40.         print("ERROR BAD CHANNEL CONTACT ADMINISTRATOR")
  41.       end
  42.     end
  43.   end
  44.   sleep(0.1)
  45. end
Add Comment
Please, Sign In to add comment