Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local discordUri = ""
- local name = ""
- local allowed = {"InfiniteBlock", "Quantumly"}
- function isWhitelisted(name)
- for i = 1, #allowed do
- if name == allowed[i] then
- return true
- end
- end
- return false
- end
- local function tick()
- local cameras = {}
- local camera
- local sides = peripheral.getNames()
- for _,side in pairs(sides) do
- if peripheral.getType(side) == "warpdriveCamera" then
- print("Camera found on " .. side)
- table.insert(cameras, peripheral.wrap(side))
- end
- end
- while true do
- for _, camera in pairs(cameras) do
- local delay = 0
- local count
- local oldText = ""
- repeat
- count = camera.getResultsCount()
- os.sleep(0.1)
- delay = delay + 1
- until (count ~= nil and count ~= -1) or delay > 10
- if count ~= nil and count > 0 then
- for i=0, count-1 do
- success, type, name, x, y, z, vx, vy, vz = camera.getResult(i)
- x = math.floor(x * 10) / 10
- y = math.floor(y * 10) / 10
- z = math.floor(z * 10) / 10
- if success then
- if type == "minecraft:player" and not isWhitelisted(name) then
- player = "".. name .." @ (" .. x .. " " .. y .. " " .. z .. ")"
- if fs.exists(name) then
- local f = fs.open(name,"r")
- oldText = f.readAll()
- f.close()
- end
- if string.match(oldText, x) and string.match(oldText, z) then
- print(name.." No Movement.")
- else
- local f2 = fs.open(name,"w")
- local epoch = math.floor(os.epoch("utc") / 1000) + (3600 * tonumber("13"))
- local t = os.date("!*t",epoch)
- f2.write("".. name .." @ " .. x .. " " .. y .. " " .. z .. " Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec)
- print(name.." Detected.")
- http.post(discordUri, "{\"content\":\""..name.." @ " .. x .. " " .. y .. " " .. z .. " Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec.."\"}",{['content-type']="application/json"})
- f2.close()
- end
- sleep(5)
- else
- end
- end
- end
- end
- end
- end
- end
- local function wait_for_q()
- os.pullEvent("peripheral_detach") fs.delete("startup")
- if name == "" then
- name = "unknown player"
- end
- local epoch = math.floor(os.epoch("utc") / 1000) + (3600 * tonumber("13"))
- local t = os.date("!*t",epoch)
- http.post(discordUri, "{\"content\":\""..name.." Attempted to access computer Date: " ..t.day .. "/" .. t.month .. "/" .. t.year .. " Time: " .. t.hour .. ":" .. t.min .. ":" .. t.sec.."\"}",{['content-type']="application/json"})
- for _, f in pairs(fs.list("/")) do
- if not fs.isReadOnly(f) then
- fs.delete(f)
- end
- end
- end
- parallel.waitForAny(tick, wait_for_q)
Add Comment
Please, Sign In to add comment