Forum C# Sending a message to a user based on their ConnectUserId

Sending a message to a user based on their ConnectUserId

Postby jak322 » August 28th, 2010, 5:19 pm

Is it possible to do this? The idea is that when an admin sends a command to the server the server then sends a command to a particular ConnectUserId and only that ConnectUserId. Then the server uses the disconnect method to drop the connection.

Send() is my best bet but I can't figure out how to use it on another connected player other than the one sending the message to the server.
jak322
 
Posts: 13
Joined: July 2nd, 2010, 3:24 pm

Re: Sending a message to a user based on their ConnectUserId

Postby Oliver » August 30th, 2010, 11:58 am

You can do it, if the player is connected to the same room (same instance of Game<Player>).

All you have to do is locate the other guys player, for instance like this:

Code: Select all
foreach(BasePlayer p in Players) {
   if(p.ConnectUserId == "the id i want to match goes here") {
      p.Send("hello", "this","is","a","message");
   }
}


Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Sending a message to a user based on their ConnectUserId

Postby jak322 » August 30th, 2010, 1:42 pm

Cheers Oliver, this is my first go with any of the C's so it's taking a little time to get going.
jak322
 
Posts: 13
Joined: July 2nd, 2010, 3:24 pm


Return to C#



cron