View difference between Paste ID: 64HL5Nhv and tUerE8gx
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("ocs/apis/sensor")
2
 
3-
--LATO SENSORE
3+
--LATO SENSORE, ROUTER E ID
4
se = sensor.wrap("top")
5
router_loc = "right"
6
receiver_id = 3748
7-
lato = "right"
7+
8
--LATO ATTIVAZIONE REDSTONE QUANDO SQUILLA L'ALLARME
9
lato = "left"
10
ritardo = 0
11-
--INSERIRE QUI LA API-KEY
11+
12-
api1 = ""
12+
13
--GIOCATORI PER CUI L'ALLARME NON SI ATTIVA
14
giocatore1 = "eternalcaos"
15-
giocatore1 = ""
15+
16
giocatore3 = ""
17
18
19
rednet.open(router_loc)
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)
30+
31-
print("Email mandata")
31+
rednet.send(receiver_id, k)
32
print("Player loggato")
33
end
34
else
35
	rs.setOutput(lato, false)
36
end
37
end
38
sleep(1)
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
end