Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function main()
- local chatBox = peripheral.find("chatBox")
- local playerDetector = peripheral.find("playerDetector")
- rednet.open("top")
- while true do
- local playerToExpose = listenForRequest()
- local onlinePlayers = playerDetector.getOnlinePlayers()
- local foundPlayer = false
- for i, name in ipairs(onlinePlayers) do
- if name == playerToExpose then
- foundPlayer = true
- end
- end
- if foundPlayer then
- local playerPosition = playerDetector.getPlayerPos(playerToExpose)
- local message = "This you, "..playerToExpose..": "..
- playerPosition.x.." "..
- playerPosition.y.." "..
- playerPosition.z.."?"
- chatBox.sendMessage(message)
- end
- end
- end
- function listenForRequest()
- _, playerName = rednet.receive("expose")
- return playerName
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement