Find players on server and get a name

How can i find players on server im playing on and get name of each one…?
I guess i’d need to give somehow a number of player i want a name of, and it would be just perfect ;D