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

Last change on this file since 266 was 238, checked in by alloc, 9 years ago

Server fixes for A12

File size: 903 bytes
RevLine 
[238]1using System;
2
3namespace AllocsFixes
4{
5 public class ChatHookExample {
6 private const string BBFILTER = "[ffffffff][/url][/b][/i][/u][/s][/sub][/sup][ff]";
7 private const string ANSWER = " [ff0000]I[-] [ff7f00]W[-][ffff00]A[-][80ff00]S[-] [00ffff]H[-][0080ff]E[-][0000ff]R[-][8b00ff]E[-]";
8
9 public static bool Hook (ClientInfo _cInfo, string _message, string _playerName) {
10 if (!string.IsNullOrEmpty (_message)) {
11 if (_message.EndsWith (BBFILTER + BBFILTER)) {
12 _message = _message.Remove (_message.Length - 2 * BBFILTER.Length);
13 }
14
15 if (_message.ToLower () == "/alloc") {
16 if (_cInfo != null) {
17 Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
18 _cInfo.SendPackage (new NetPackageGameMessage (ANSWER, ""));
19 } else {
20 Log.Error ("Argument _cInfo null on message: {0}", _message);
21 }
22 return false;
23 }
24 }
25
26 return true;
27 }
28
29 }
30}
Note: See TracBrowser for help on using the repository browser.