Advertisement
GDragonArcher

General Tracking

Apr 15th, 2022 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. --find and set up all peripherals
  2.  
  3. local detector = peripheral.find("playerDetector") -- Finds the peripheral if one is connected
  4. if detector == nil then error("playerDetector not found") end
  5.  
  6.  
  7.  
  8. while true do
  9.  
  10.     --setup all local variables
  11.     local line = 1 --current line number on monitor
  12.     local players = detector.getOnlinePlayers()
  13.     local numPlayers = #players
  14.     local i = 1
  15.    
  16.    
  17.     --clear screen
  18.     term.clear()
  19.     term.setCursorPos(1,1)
  20.    
  21.    
  22.     --print to screen
  23.     for i = 1, numPlayers do
  24.         local pos = detector.getPlayerPos(players[i]) --set what player you want the pos of
  25.        
  26.         if pos == nill then
  27.             print(players[i])
  28.             print("is in another dimension")
  29.         else
  30.             print(players[i]) --write player name
  31.             io.write("X:")
  32.             io.write(pos.x) --write the x pos of the player  
  33.             io.write("      Y:")
  34.             io.write(pos.y) --write the y pos of the player  
  35.             io.write("      Z:")
  36.             io.write(pos.z) --write the z pos of the player
  37.             print()
  38.             print()
  39.         end
  40.  
  41.         i = i + 1 --index i value
  42.     end
  43.    
  44.    
  45.     sleep(5)
  46.  
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement