Guest User

startup

a guest
Jul 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. os.loadAPI("ocs/apis/sensor")
  2. prox = sensor.wrap("back")
  3. lato = "right"
  4. ritardo = 0
  5.  
  6. api1 = "56c6dc06748fb005225a39e8f1b2c86b"
  7. api2 = "778935638247eddf41c6ad63c77dff4e"
  8.  
  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. http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api2.."&var1="..giocatore)
  15. print("Email mandata")
  16. end
  17. end
  18. while true do
  19. term.clear()
  20. term.setCursorPos(1, 1)
  21. giocatore = string.match(textutils.serialize(prox.getTargets()), '%w+')
  22. if giocatore == nil then
  23. print("Nessun giocatore rilevato")
  24. rs.setOutput(lato, false)
  25. elseif giocatore == "Ale041" or giocatore == "SaniiM" or giocatore == "lego11" then
  26. print("Giocatore autorizzato rilevato: "..giocatore)
  27. rs.setOutput(lato, false)
  28. else
  29. print("Rilevato giocatore non autorizzato: "..giocatore)
  30. mandaEmail()
  31. rs.setOutput(lato, true)
  32. end
  33.  
  34. if emailMandata == 1 then
  35. ritardo = ritardo + 1
  36. end
  37.  
  38. if ritardo == 120 then
  39. ritardo = 0
  40. emailMandata = 0
  41. end
  42.  
  43. sleep(1)
  44. end
Advertisement
Add Comment
Please, Sign In to add comment