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

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

More cleanup, allocation improvements

File size: 720 bytes
RevLine 
[325]1namespace AllocsFixes {
[238]2 public class ChatHookExample {
[325]3 private const string ANSWER =
4 " [ff0000]I[-] [ff7f00]W[-][ffff00]A[-][80ff00]S[-] [00ffff]H[-][0080ff]E[-][0000ff]R[-][8b00ff]E[-]";
[238]5
[324]6 public static bool Hook (ClientInfo _cInfo, EChatType _type, string _message, string _playerName) {
[326]7 if (string.IsNullOrEmpty (_message) || !_message.EqualsCaseInsensitive ("/alloc")) {
8 return true;
9 }
[325]10
[326]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);
[238]16 }
17
[326]18 return false;
19
[238]20 }
21 }
[325]22}
Note: See TracBrowser for help on using the repository browser.