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

Last change on this file since 287 was 276, checked in by alloc, 8 years ago

fixes 8_11_13_1

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