lego11

Allarme con sbrodolatura

Dec 13th, 2018
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2.  
  3. --LATO SENSORE
  4. prox = sensor.wrap("right")
  5.  
  6.  
  7. --INSERIRE QUI LA API-KEY
  8. api1 = "sbrodolatura-epco-lincroft"
  9. emailMandata = 0
  10. function mandaEmail()
  11. if emailMandata == 0 then
  12. emailMandata = 1
  13. http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api1.."&var1="..giocatore)
  14. print("Email mandata")
  15. end
  16. end
  17.  
  18. while true do
  19. term.clear()
  20. term.setCursorPos(1, 1)
  21. event = os.pullEvent("redstone")
  22. giocatore = textutils.serialize(prox.getTargets())
  23. print("Rilevato giocatore non autorizzato: "..giocatore)
  24. mandaEmail()
  25.  
  26. if emailMandata == 1 then
  27. ritardo = ritardo + 1
  28. end
  29.  
  30. if ritardo == 120 then
  31. ritardo = 0
  32. emailMandata = 0
  33. end
  34.  
  35. sleep(1)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment