MessageMgr::SendMessage
Defined in:
Sends a message to a player in a multiplayer game.
C4Messages.hPrototype
void SendMessage(PlayerKey key, const Message& message);
Parameters
key |
The key of the player that the message will be sent to. |
message |
The message to be sent. |
Description
The SendMessage function locates the player whose key matches the key parameter and sends the message given by the message parameter to that player. If no player with the specified key exists, then SendMessage returns without sending the message.The
key parameter may be the actual key of a player, or it may be one of the following special constants.
kPlayerServer |
The message is sent to the server. If the local machine is the server, then the message is received immediately and is processed before SendMessage returns.
|
kPlayerSelf |
The message is sent to the local machine. The message is received immediately and is processed before SendMessage returns.
|
kPlayerAll |
The message is sent to all players and to the local machine. Specifying this key is equivalent to calling the MessageMgr::SendMessageAll function.
|
kPlayerClients |
The message is sent to all client machines. This may only be specified if the sending machine is the server, and it is equivalent to calling the MessageMgr::SendMessageClients function.
|
SendMessage function has no effect if there is no connection corresponding to the recipient.
Special Considerations
If a pointer to a Player object is available, it is generally better to call Player::SendMessage to send a message to that player instead of calling MessageMgr::SendMessage with the player's key.
See Also
MessageMgr::SendMessageClients
