Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Open the rednet and set the target port
- rednet.open("back") -- Assuming the modem is built into the pocket computer
- -- Function to request player distances
- local function requestPlayerDistances()
- -- Send a request for distances on all available ports
- rednet.broadcast("request_distance")
- print("Request sent. Awaiting response...")
- -- Wait for the response
- local senderID, playerData = rednet.receive()
- if playerData then
- print("Received player distances from ID: " .. senderID)
- for _, player in pairs(playerData) do
- print("Player: " .. player.name .. " -- Distance: " .. player.distance)
- end
- else
- print("No response received.")
- end
- end
- -- Run the request function once
- requestPlayerDistances()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement