Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. --LATO SENSORE
  4. se = sensor.wrap("top")
  5.  
  6. --LATO ATTIVAZIONE REDSTONE QUANDO SQUILLA L'ALLARME
  7. lato = "right"
  8. ritardo = 0
  9.  
  10.  
  11. --INSERIRE QUI LA API-KEY
  12. api1 = "57f20dbd583ab7dafdd9736883e54244"
  13.  
  14. --GIOCATORI PER CUI L'ALLARME NON SI ATTIVA
  15. giocatore1 = "DROVOSEK_"
  16. giocatore2 = "MRCorona"
  17. giocatore3 = ""
  18.  
  19.  
  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. http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api1.."&var1="..k)
  31. print("Email mandata")
  32. end
  33. else
  34. rs.setOutput(lato, false)
  35. end
  36. end
  37. sleep(1)
  38. if emailMandata == 1 then
  39. ritardo = ritardo + 1
  40. end
  41.  
  42. if ritardo == 120 then
  43. ritardo = 0
  44. emailMandata = 0
  45. end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement