View difference between Paste ID: ixde8e7J and iirEhRW6
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("ocs/apis/sensor")
2
3
place = ""
4
distance = 10
5
alarmSide = "right"
6
teslaSide = "left"
7
sensorSide = "top"
8
enableRequired = false
9
enabledSide = "back"
10-
duration = 120
10+
11-
sendEmail = false
11+
12
se = sensor.wrap(sensorSide)
13-
apiKey = ""
13+
14
    term.clear()
15-
allowedPlayers = {}
15+
16-
rest = http.get("http://172.16.20.227/~fabrimat/proclus-acl.php")
16+
17-
s = rest.readAll()
17+
18-
shell.run("pastebin get ADaQ4War json")
18+
19-
os.loadAPI("json")
19+
20-
t = json.decode(s)
20+
21-
for key, val in pairs(t) do
21+
22-
    table.insert(allowedPlayers, val.Name)
22+
23-
end
23+
24
          details ~= nil and 
25
          details.Position ~= nil and 
26-
emailSent = true
26+
27-
timer = 0
27+
28
          details.Position.Y <= distance and 
29
          details.Position.Y >= -distance and 
30-
local function has_value (tab, val)
30+
31-
    for index, value in pairs(tab) do
31+
32-
        if value == val then
32+
                if details.Gamemode then
33-
            return true
33+
34
                end
35
            end
36
        end
37-
    return false
37+
38-
end
38+
        if allowed  then
39
            rs.setOutput(teslaSide, true)
40
        else
41-
    if timer > 0 then
41+
42-
        timer = timer - 1
42+
43
    else
44-
        emailSent = false
44+
45
        print("Alarm system disabled")
46
        rs.setOutput(alarmSide, false)
47
        rs.setOutput(teslaSide, false)
48
    end
49
    
50
    sleep(1)
51
end