source: TFP-WebServer/CommandExtensions/src/ChatHelpers.cs@ 496

Last change on this file since 496 was 485, checked in by alloc, 9 months ago

22.0.0.0 Commands release

  • Only A22 compatibility fix

22.0.0.0 MapRendering release (no code changes)

22.0.1.0 WebServer release

  • Updated to dashboard files 0.8.5
  • Added API 'EntityClass'
  • Changed API 'Command' default permissions
  • Added some A22 compatibility changes
  • Fixed some OpenAPI docs

22.0.1.0 MarkersMod release

  • Updated web files
File size: 745 bytes
Line 
1namespace CommandExtensions {
2 public static class ChatHelpers {
3 public static void SendMessage (ClientInfo _receiver, ClientInfo _sender, string _message) {
4 string senderName;
5 if (_sender != null) {
6 PrivateMessageConnections.SetLastPMSender (_sender, _receiver);
7 senderName = _sender.playerName;
8 } else {
9 senderName = "Server";
10 }
11
12 _receiver.SendPackage (NetPackageManager.GetPackage<NetPackageChat> ().Setup (EChatType.Whisper, -1, _message,
13 $"{senderName} (PM)", null));
14 string receiverName = _receiver.playerName;
15 receiverName = receiverName != null ? $"\"{receiverName}\"" : "unknownName";
16 SdtdConsole.Instance.Output ($"Message to player {receiverName} sent with sender \"{senderName}\"");
17 }
18 }
19}
Note: See TracBrowser for help on using the repository browser.