Advertisement
Guest User

startup

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