Fra146

AllarmeRedNet SERVER

Nov 26th, 2020 (edited)
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. --LATO SENSORE, ROUTER E ID
  4. se = sensor.wrap("top")
  5. router_loc = "right"
  6. receiver_id = 3748
  7.  
  8. --LATO ATTIVAZIONE REDSTONE QUANDO SQUILLA L'ALLARME
  9. lato = "left"
  10. ritardo = 0
  11.  
  12.  
  13. --GIOCATORI PER CUI L'ALLARME NON SI ATTIVA
  14. giocatore1 = "eternalcaos"
  15. giocatore2 = ""
  16. giocatore3 = ""
  17.  
  18.  
  19. rednet.open(router_loc)
  20. emailMandata = 0
  21. os.loadAPI("ocs/apis/sensor")
  22. while true do
  23. ta = se.getTargets()
  24. for k,v in pairs(ta) do
  25. if v["Name"] == "Player" and k ~= "lego11" and k ~= giocatore1 and k ~= giocatore2 and k ~= giocatore3 then
  26. print("Rilevato giocatore non autorizzato: "..k)
  27. rs.setOutput(lato, true)
  28. if emailMandata == 0 then
  29. emailMandata = 1
  30.  
  31. rednet.send(receiver_id, k)
  32. print("Player loggato")
  33. end
  34. else
  35.     rs.setOutput(lato, false)
  36. end
  37. end
  38. sleep(1)
  39. if emailMandata == 1 then
  40. ritardo = ritardo + 1
  41. end
  42.  
  43. if ritardo == 120 then
  44. ritardo = 0
  45. emailMandata = 0
  46. end
  47. end
Add Comment
Please, Sign In to add comment