Exemplo n.º 1
0
        protected override void OnChatMessage(ref ChatMsg msg, ulong sender)
        {
            bool debugCommands = !MyFinalBuildConstants.IS_OFFICIAL && MyFinalBuildConstants.IS_DEBUG;

            msg.Author = sender;
            if (m_memberData.ContainsKey(sender))
            {
                if (m_memberData[sender].IsAdmin || debugCommands)
                {
                    if (msg.Text.Equals("+save", StringComparison.InvariantCultureIgnoreCase))
                    {
                        MySession.Static.Save();
                    }
                    else if (msg.Text.Contains("+unban", StringComparison.InvariantCultureIgnoreCase))
                    {
                        string[] parts = msg.Text.Split(' ');
                        if (parts.Length > 1)
                        {
                            ulong user = 0;
                            if (ulong.TryParse(parts[1], out user))
                            {
                                BanClient(user, false);
                            }
                        }
                    }
                }
                if (debugCommands)
                {
                    MyServerDebugCommands.Process(msg.Text, msg.Author);
                }
            }

            SendControlMessageToAll(ref msg, msg.Author);
            RaiseChatMessageReceived(sender, msg.Text, ChatEntryTypeEnum.ChatMsg);
        }
Exemplo n.º 2
0
        public override void OnChatMessage(ref ChatMsg msg)
        {
            MyMultiplayerBase.MyConnectedClientData data;
            bool flag = false;

            if (base.MemberDataGet(msg.Author, out data) && (data.IsAdmin | flag))
            {
                MyServerDebugCommands.Process(msg.Text, msg.Author);
            }
            string str = Sync.Players.TryGetIdentityNameFromSteamId(msg.Author);

            if (string.IsNullOrEmpty(str) && (msg.Author == Sync.MyId))
            {
                str = MyTexts.GetString(MySpaceTexts.ChatBotName);
            }
            if (!string.IsNullOrEmpty(str))
            {
                MyChatMessage message1 = new MyChatMessage();
                message1.SteamId    = msg.Author;
                message1.AuthorName = string.IsNullOrEmpty(msg.CustomAuthorName) ? str : msg.CustomAuthorName;
                MyChatMessage item = message1;
                item.Text      = msg.Text;
                item.Timestamp = DateTime.UtcNow;
                this.m_globalChatHistory.Add(item);
            }
            this.RaiseChatMessageReceived(msg.Author, msg.Text, (ChatChannel)msg.Channel, msg.TargetId, string.IsNullOrEmpty(msg.CustomAuthorName) ? null : msg.CustomAuthorName);
        }
        protected override void OnChatMessage(ref ChatMsg msg)
        {
            bool debugCommands = !MyFinalBuildConstants.IS_OFFICIAL && MyFinalBuildConstants.IS_DEBUG;

            if (m_memberData.ContainsKey(msg.Author))
            {
                if (m_memberData[msg.Author].IsAdmin || debugCommands)
                {
                    MyServerDebugCommands.Process(msg.Text, msg.Author);
                }
            }


            RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg);
        }