Advertisement
colhaydutu

atm9 online players info screen

Jan 25th, 2024 (edited)
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. monitor = peripheral.wrap("left")
  2. sensor = peripheral.wrap("right")
  3.  
  4. while true do
  5. monitor.setTextColor(colors.lime)
  6. monitor.setBackgroundColor(colors.gray)
  7. monitor.clear()
  8. monitor.setCursorPos(1, 1)
  9. monitor.write("Online Players")
  10. monitor.setTextScale(1.5)
  11.  
  12. players = sensor.getOnlinePlayers()
  13.  
  14. local yPos = 3
  15.  
  16. for _, player in ipairs(players) do
  17. monitor.setCursorPos(1, yPos)
  18. monitor.write(player)
  19. yPos = yPos + 1
  20. end
  21.  
  22. local totalPlayers = #players
  23. monitor.setCursorPos(1, yPos+1)
  24. monitor.write("Total Players: " .. totalPlayers)
  25.  
  26. sleep(1)
  27. end
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement