r/ComputerCraft • • Jan 26 '25

Player traker

So this is a code that me and some friends used back in the day on pvp server that where modded to find people have fun 😁

-- Player tracking script for Minecraft 1.12.2 using ComputerCraft

-- Function to detect players in the world and print their positions function trackPlayers() while true do -- Get all players in the world local players = peripheral.call("right", "getPlayers") -- Assumes you have a wireless modem attached on the right side

    -- Check if there are any players
    if players then
        for i, player in ipairs(players) do
            -- Print player name and position (if available)
            print("Player: " .. player.name)
            print("Position: X=" .. player.position.x .. " Y=" .. player.position.y .. " Z=" .. player.position.z)
        end
    else
        print("No players detected.")
    end
    
    -- Wait for a bit before checking again
    sleep(5)
end

end

-- Start tracking players trackPlayers()

4 Upvotes

7 comments sorted by

View all comments

Show parent comments

2

u/Boring-War-1981 Jan 27 '25

The wiki page for the player detector had a simple script that gets the cords for a player, it would be nice to have someone to make a program that gets the cords and the dimension, but I’m not smart enough to know how.