Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Open the peripheral connected to the Advanced Computer
- local playerDetector = peripheral.wrap("side_of_player_detector") -- Replace "side_of_player_detector" with the actual side of the Player Detector
- -- Function to get online players
- local function getOnlinePlayers()
- local onlinePlayers = playerDetector.getOnlinePlayers()
- return onlinePlayers
- end
- -- Function to display online players on the terminal
- local function displayOnlinePlayers()
- local onlinePlayers = getOnlinePlayers()
- term.clear() -- Clear the terminal screen
- print("Online Players:")
- for _, player in ipairs(onlinePlayers) do
- print("- " .. player)
- end
- end
- -- Main loop to continuously display online players
- while true do
- displayOnlinePlayers()
- os.sleep(5) -- Refresh every 5 seconds (adjust as needed)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement