source: binary-improvements/7dtd-server-fixes/src/ChatHookExample.cs@ 340

Last change on this file since 340 was 326, checked in by alloc, 6 years ago

More cleanup, allocation improvements

File size: 720 bytes
Line 
1namespace AllocsFixes {
2 public class ChatHookExample {
3 private const string ANSWER =
4 " [ff0000]I[-] [ff7f00]W[-][ffff00]A[-][80ff00]S[-] [00ffff]H[-][0080ff]E[-][0000ff]R[-][8b00ff]E[-]";
5
6 public static bool Hook (ClientInfo _cInfo, EChatType _type, string _message, string _playerName) {
7 if (string.IsNullOrEmpty (_message) || !_message.EqualsCaseInsensitive ("/alloc")) {
8 return true;
9 }
10
11 if (_cInfo != null) {
12 Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
13 _cInfo.SendPackage (new NetPackageChat (EChatType.Whisper, -1, ANSWER, "", false, null));
14 } else {
15 Log.Error ("ChatHookExample: Argument _cInfo null on message: {0}", _message);
16 }
17
18 return false;
19
20 }
21 }
22}
Note: See TracBrowser for help on using the repository browser.