Rev | Line | |
---|
[238] | 1 | using System;
|
---|
| 2 |
|
---|
| 3 | namespace 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 |
|
---|
[267] | 8 | public static bool Hook (ClientInfo _cInfo, EnumGameMessages _type, string _message, string _playerName) {
|
---|
[273] | 9 | if (_type == EnumGameMessages.Chat && !string.IsNullOrEmpty (_message)) {
|
---|
[238] | 10 | if (_message.ToLower () == "/alloc") {
|
---|
| 11 | if (_cInfo != null) {
|
---|
| 12 | Log.Out ("Sent chat hook reply to {0}", _cInfo.playerId);
|
---|
[267] | 13 | _cInfo.SendPackage (new NetPackageGameMessage (EnumGameMessages.Chat, ANSWER, "", false, "", false));
|
---|
[273] | 14 | GameManager.Instance.GameMessageServer (_cInfo, EnumGameMessages.Chat, string.Format("!{0}", _message), _playerName, false, "", false);
|
---|
[238] | 15 | } else {
|
---|
| 16 | Log.Error ("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.