24.08.2020, 20:27
If I adjust the first code, will this work?
Code:
obj1 = grp.find('0/2/6') -- "lock"
obj2 = grp.find('0/2/7') -- "normal"
obj3 = grp.find('0/2/5') -- "2 hour lock"
now = os.time() -- current timestamp in seconds
delta1 = now - obj1.updatetime -- last object update relative time
delta2 = now - obj2.updatetime -- last object update relative time
delta3 = now - obj3.updatetime -- last object update relative time
if (delta1 > delta3) and (obj2.value and delta2 > (2 * 60 * 60)) then
obj2:write(false)
end