How to check online whether the player having only the player's name.

Options
AkaruZ
AkaruZ
edited June 2017 in Any Topic & Chat
Hello! I'm trying to implement a private chat. I have an inputField in which I enter the name of the required player. While sending a message, I need to check whether this player is online, how do I do this? Thank you all!

I think I need to use photonNetwork.playerList, but i don't know how to call this player rpc
                    
var playerList = from playr in PhotonNetwork.playerList
select playr;
foreach (var player in playerList)
{
if (player.NickName == name)
{
PhotonView.Get(NEED HELP).photonView.RPC("givePrivateMessage", PhotonTargets.All, text, PhotonNetwork.playerName, false);
                }
            }