SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("ocs/apis/sensor")
| |
| 2 | - | prox = sensor.wrap("back")
|
| 2 | + | |
| 3 | --LATO SENSORE | |
| 4 | prox = sensor.wrap("top")
| |
| 5 | ||
| 6 | - | api1 = "148d6933a3bb46985080ad58c66790e4" |
| 6 | + | --LATO ATTIVAZIONE REDSTONE QUANDO SQUILLA L'ALLARME |
| 7 | lato = "right" | |
| 8 | ritardo = 0 | |
| 9 | ||
| 10 | ||
| 11 | --INSERIRE QUI LA API-KEY | |
| 12 | api1 = "" | |
| 13 | emailMandata = 0 | |
| 14 | function mandaEmail() | |
| 15 | if emailMandata == 0 then | |
| 16 | emailMandata = 1 | |
| 17 | http.get("http://172.16.20.220/luanet/servlets/notifier.php?api="..api1.."&var1="..giocatore)
| |
| 18 | print("Email mandata")
| |
| 19 | end | |
| 20 | end | |
| 21 | while true do | |
| 22 | - | elseif giocatore == "lego11" or giocatore == "CrackMaster04" then |
| 22 | + | |
| 23 | term.setCursorPos(1, 1) | |
| 24 | giocatore = string.match(textutils.serialize(prox.getTargets()), '%w+') | |
| 25 | if giocatore == nil then | |
| 26 | print("Nessun giocatore rilevato")
| |
| 27 | rs.setOutput(lato, false) | |
| 28 | ||
| 29 | --INSERIRE QUI I NOMI DEI GIOCATORI AUTORIZZATI (LASCIARE LEGO11 GRAZIE) | |
| 30 | elseif giocatore == "lego11" or giocatore == "" then | |
| 31 | print("Giocatore autorizzato rilevato: "..giocatore)
| |
| 32 | rs.setOutput(lato, false) | |
| 33 | else | |
| 34 | print("Rilevato giocatore non autorizzato: "..giocatore)
| |
| 35 | mandaEmail() | |
| 36 | rs.setOutput(lato, true) | |
| 37 | end | |
| 38 | ||
| 39 | if emailMandata == 1 then | |
| 40 | ritardo = ritardo + 1 | |
| 41 | end | |
| 42 | ||
| 43 | if ritardo == 120 then | |
| 44 | ritardo = 0 | |
| 45 | emailMandata = 0 | |
| 46 | end | |
| 47 | ||
| 48 | sleep(1) | |
| 49 | end |