Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local e = peripheral.find("EntityDetector")
- local w = peripheral.find("WorldInterface")
- if not fs.exists("/logs/") then
- fs.makeDir("/logs/")
- end
- while true do
- for i = 1, #w.getPlayerList() do
- local actualPlayer = w.getPlayerList()[1]
- local tActualPlayer = e.getPlayerDetail(actualPlayer)[actualPlayer]
- --fs.delete("/logs/"..actualPlayer)
- if not fs.exists("/logs/"..actualPlayer) then
- local file = fs.open("/logs/"..actualPlayer, "w")
- local tPlayerInfos = {}
- local nPlayerX = math.floor(math.abs(tActualPlayer["x"]))
- local nPlayerY = math.floor(math.abs(tActualPlayer["y"]))
- local nPlayerZ = math.floor(math.abs(tActualPlayer["z"]))
- print(actualPlayer.."\n".."@ "..nPlayerX..", "..nPlayerY..", "..nPlayerZ)
- local nChunkX = math.floor(math.abs(nPlayerX / 16))
- local nChunkY = math.floor(math.abs(nPlayerY / 16))
- local nChunkZ = math.floor(math.abs(nPlayerZ / 16))
- print("C : "..nChunkX..", "..nChunkY..", "..nChunkZ)
- table.insert(tPlayerInfos, {chunkX=nChunkX, chunkY=nChunkY, chunkZ=nChunkZ, time=1})
- file.write(tPlayerInfos)
- else
- local file = fs.open("/logs/"..actualPlayer, "r")
- local tPlayerInfos = file.readAll()
- tPlayerInfos = textutils.unserialise(tPlayerInfos)
- file.close()
- local file = fs.open("/logs/"..actualPlayer, "w")
- end
- file.close()
- end
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment