Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local allowed = {"Ares_Xiao_Hu", "Destiney"}
- -- Function to check if a player's name is in the whitelist.
- local function isWhitelisted(playerName)
- for i = 1, #allowed do
- if playerName == allowed[i] then
- return true
- end
- end
- return false
- end
- local function tick()
- local cameras = {}
- local sides = peripheral.getNames()
- -- Find and wrap all warpdrive cameras.
- 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 ipairs(cameras) do
- local count = camera.getResultsCount()
- if count and count > 0 then
- for i = 0, count - 1 do
- local success, entityType, playerName, x, y, z = camera.getResult(i)
- if success and entityType == "minecraft:player" and not isWhitelisted(playerName) then
- x = math.floor(x * 10) / 10
- y = math.floor(y * 10) / 10
- z = math.floor(z * 10) / 10
- print(playerName .. " detected at (" .. x .. ", " .. y .. ", " .. z .. ")")
- end
- end
- end
- os.sleep(0.1)
- end
- end
- end
- tick()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement