Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --find and set up all peripherals
- local detector = peripheral.find("playerDetector") -- Finds the peripheral if one is connected
- if detector == nil then error("playerDetector not found") end
- while true do
- --setup all local variables
- local line = 1 --current line number on monitor
- local players = detector.getOnlinePlayers()
- local numPlayers = #players
- local i = 1
- --clear screen
- term.clear()
- term.setCursorPos(1,1)
- --print to screen
- for i = 1, numPlayers do
- local pos = detector.getPlayerPos(players[i]) --set what player you want the pos of
- if pos == nill then
- print(players[i])
- print("is in another dimension")
- else
- print(players[i]) --write player name
- io.write("X:")
- io.write(pos.x) --write the x pos of the player
- io.write(" Y:")
- io.write(pos.y) --write the y pos of the player
- io.write(" Z:")
- io.write(pos.z) --write the z pos of the player
- print()
- print()
- end
- i = i + 1 --index i value
- end
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement