SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("ocs/apis/sensor")
| |
| 2 | ||
| 3 | --LATO SENSORE | |
| 4 | - | se = sensor.wrap("top")
|
| 4 | + | se = sensor.wrap("right")
|
| 5 | ||
| 6 | --LATO ATTIVAZIONE REDSTONE QUANDO SQUILLA L'ALLARME | |
| 7 | - | lato = "right" |
| 7 | + | lato = "left" |
| 8 | ritardo = 0 | |
| 9 | ||
| 10 | --GIOCATORI PER CUI L'ALLARME NON SI ATTIVA | |
| 11 | - | --INSERIRE QUI LA API-KEY |
| 11 | + | giocatore1 = "Kiiw" |
| 12 | - | api1 = "" |
| 12 | + | giocatore2 = "Lay4play" |
| 13 | giocatore3 = "" | |
| 14 | ||
| 15 | - | giocatore1 = "" |
| 15 | + | |
| 16 | - | giocatore2 = "" |
| 16 | + | |
| 17 | os.loadAPI("ocs/apis/sensor")
| |
| 18 | while true do | |
| 19 | ta = se.getTargets() | |
| 20 | for k,v in pairs(ta) do | |
| 21 | if v["Name"] == "Player" and k ~= "lego11" and k ~= giocatore1 and k ~= giocatore2 and k ~= giocatore3 then | |
| 22 | print("Rilevato giocatore non autorizzato: "..k)
| |
| 23 | rs.setOutput(lato, true) | |
| 24 | if emailMandata == 0 then | |
| 25 | emailMandata = 1 | |
| 26 | http.get("http://172.16.20.220/luanet/servlets/pirlator.php?user="..k)
| |
| 27 | print("Email mandata")
| |
| 28 | end | |
| 29 | else | |
| 30 | - | http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api1.."&var1="..k)
|
| 30 | + | |
| 31 | end | |
| 32 | end | |
| 33 | sleep(1) | |
| 34 | if emailMandata == 1 then | |
| 35 | ritardo = ritardo + 1 | |
| 36 | end | |
| 37 | ||
| 38 | if ritardo == 600 then | |
| 39 | ritardo = 0 | |
| 40 | emailMandata = 0 | |
| 41 | end | |
| 42 | - | if ritardo == 120 then |
| 42 | + |