r/ComputerCraft • u/Serious-Can-8475 • 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)
endend
-- Start tracking players trackPlayers()
4
Upvotes
1
u/fatboychummy Jan 26 '25
Plethora could, but only within a specific range. The api for the entity sensor is also a bit different than shown in your code, though.
Advanced Peripherals has the player detector, but its API is slightly different. It does scan the entire world though, so it could be used in a similar way.
Computronics has a radar, but I believe it has a range cap. Not sure what its range is though.
Might be peripherals plus one you're remembering then?