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