protected override void OnChatMessage(ref ChatMsg msg) { if (m_memberData.ContainsKey(msg.Author)) { if (m_memberData[msg.Author].IsAdmin) { if (msg.Text.ToLower().Contains("+unban")) { string[] parts = msg.Text.Split(' '); if (parts.Length > 1) { ulong user = 0; if (ulong.TryParse(parts[1], out user)) { BanClient(user, false); } } } else if (msg.Text.ToLower() == "+reload") { MySandboxGame.ReloadDedicatedServerSession(); } } } RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg); }
protected static void SendChatMessage(ref ChatMsg msg) { EndpointId targetEndpoint = new EndpointId(); Vector3D? position = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_Server), msg, targetEndpoint, position); }
void OnChatMessage(ref ChatMsg msg, ulong sender) { if (m_memberData.ContainsKey(sender)) { if (m_memberData[sender].IsAdmin) { if (msg.Text.ToLower() == "+save") { MySession.Static.Save(); } else if (msg.Text.ToLower().Contains("+unban")) { string[] parts = msg.Text.Split(' '); if (parts.Length > 1) { ulong user = 0; if (ulong.TryParse(parts[1], out user)) { BanClient(user, false); } } } } } RaiseChatMessageReceived(sender, msg.Text, ChatEntryTypeEnum.ChatMsg); }
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); }
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); }
public override void SendChatMessage(string text) { ChatMsg msg = new ChatMsg(); msg.Text = text; SendControlMessageToAllAndSelf(ref msg); }
public override void OnChatMessage(ref ChatMsg msg) { bool flag = false; if (this.m_memberData.ContainsKey(msg.Author) && (this.m_memberData[msg.Author].IsAdmin | flag)) { MyClientDebugCommands.Process(msg.Text, msg.Author); } this.RaiseChatMessageReceived(msg.Author, msg.Text, (ChatChannel)msg.Channel, msg.TargetId, string.IsNullOrEmpty(msg.CustomAuthorName) ? string.Empty : msg.CustomAuthorName); }
public override void SendChatMessage(string text) { ChatMsg msg = new ChatMsg(); msg.Text = text; msg.Author = MySteam.UserId; // This will send the message to every client except message author OnChatMessage(ref msg, MySteam.UserId); }
public override void SendChatMessage(string text) { ChatMsg msg = new ChatMsg(); msg.Text = text; msg.Author = Sync.MyId; OnChatMessage(ref msg, MySteam.AppId); SendControlMessage(ServerId, ref msg); }
public override void SendChatMessage(string text) { ChatMsg msg = new ChatMsg(); msg.Text = text; msg.Author = Sync.MyId; SendChatMessage(ref msg); // This will send the message to every client except message author OnChatMessage(ref msg); }
public override void SendChatMessage(string text) { ChatMsg msg = new ChatMsg(); msg.Text = text; msg.Author = Sync.MyId; OnChatMessage(ref msg); SendChatMessage(ref msg); }
public override void SendChatMessage(string text, ChatChannel channel, long targetId = 0L) { ChatMsg msg = new ChatMsg { Text = text, Author = Sync.MyId, Channel = (byte)channel, TargetId = targetId, CustomAuthorName = string.Empty }; SendChatMessage(ref msg); }
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) { MyClientDebugCommands.Process(msg.Text, msg.Author); } } RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg); }
public override unsafe void SendChatMessageScripted(string text, ChatChannel channel, long targetId = 0L, string customAuthor = null) { ChatMsg *msgPtr1; ChatMsg msg = new ChatMsg { Text = text, Author = Sync.MyId, Channel = (byte)channel, TargetId = targetId }; msgPtr1->CustomAuthorName = string.IsNullOrEmpty(customAuthor) ? string.Empty : customAuthor; msgPtr1 = (ChatMsg *)ref msg; SendChatMessage(ref msg); }
public void SendChatMessageToPlayer(string text, ulong steamId) { if (MyMultiplayer.Static.IsServer) { ChatMsg msg = new ChatMsg { Text = text, Author = Sync.MyId, Channel = 3, CustomAuthorName = string.Empty }; Vector3D?position = null; MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_ToPlayer), msg, new EndpointId(steamId), position); } }
public override unsafe void SendChatMessageScripted(string text, ChatChannel channel, long targetId = 0L, string customAuthor = null) { ChatMsg *msgPtr1; ChatMsg msg2 = new ChatMsg { Text = "This is god speaking! You are not allowed to send scripted messages from client so your message will be suppressed.", Author = Sync.MyId, Channel = 1, TargetId = MySession.Static.LocalPlayerId }; msgPtr1->CustomAuthorName = string.IsNullOrEmpty(customAuthor) ? MyTexts.GetString(MySpaceTexts.ChatBotName) : customAuthor; msgPtr1 = (ChatMsg *)ref msg2; ChatMsg msg = msg2; this.OnChatMessage(ref msg); }
protected abstract void OnChatMessage(ref ChatMsg msg, ulong sender);
static void OnChatMessageRecieved(ChatMsg msg) { MyMultiplayer.Static.OnChatMessage(ref msg); }
public virtual void OnChatMessage(ref ChatMsg msg) { }
protected virtual void OnChatMessage(ref ChatMsg msg) { }
protected static void SendChatMessage(ref ChatMsg msg) { MyMultiplayer.RaiseStaticEvent(s => MyMultiplayerBase.OnChatMessageRecieved, msg); }
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); }
protected override void OnChatMessage(ref ChatMsg msg, ulong sender) { msg.Author = sender; if (m_memberData.ContainsKey(sender)) { if (m_memberData[sender].IsAdmin) { if (msg.Text.ToLower().Contains("+unban")) { string[] parts = msg.Text.Split(' '); if (parts.Length > 1) { ulong user = 0; if (ulong.TryParse(parts[1], out user)) { BanClient(user, false); } } } else if (msg.Text.ToLower() == "+reload") { MySandboxGame.ReloadDedicatedServerSession(); } } } SendControlMessageToAll(ref msg, msg.Author); RaiseChatMessageReceived(sender, msg.Text, ChatEntryTypeEnum.ChatMsg); }
protected override void OnChatMessage(ref ChatMsg msg) { RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg); }
void OnChatMessage(ref ChatMsg msg, ulong sender) { RaiseChatMessageReceived(sender, msg.Text, ChatEntryTypeEnum.ChatMsg); }
private static void OnChatMessageRecieved_BroadcastExcept(ChatMsg msg) { Sandbox.Engine.Multiplayer.MyMultiplayer.Static.OnChatMessage(ref msg); }
protected static void OnChatMessageRecieved_ToPlayer(ChatMsg msg) { Sandbox.Engine.Multiplayer.MyMultiplayer.Static.OnChatMessage(ref msg); }
private static void OnChatMessageRecieved_Server(ChatMsg msg) { Vector3D? nullable; EndpointId sender = MyEventContext.Current.Sender; string playerName = sender.ToString(); string playerName = msg.TargetId.ToString(); switch (msg.Channel) { case 0: playerName = GetPlayerName(MyEventContext.Current.Sender.Value); playerName = "everyone"; nullable = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_BroadcastExcept), msg, MyEventContext.Current.Sender, nullable); goto TR_0003; case 1: if (msg.TargetId <= 0L) { sender = new EndpointId(); nullable = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_BroadcastExcept), msg, sender, nullable); } else { ulong num3 = MySession.Static.Players.TryGetSteamId(msg.TargetId); if (num3 != 0) { playerName = GetPlayerName(MyEventContext.Current.Sender.Value); playerName = GetPlayerName(msg.TargetId); nullable = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_SingleTarget), msg, new EndpointId(num3), nullable); } } goto TR_0003; case 2: { IMyFaction faction = MySession.Static.Factions.TryGetFactionById(msg.TargetId); if (faction == null) { goto TR_0003; } else { playerName = GetPlayerName(MyEventContext.Current.Sender.Value); playerName = faction.Tag; foreach (KeyValuePair <long, MyFactionMember> pair in faction.Members) { if (!MySession.Static.Players.IsPlayerOnline(pair.Value.PlayerId)) { continue; } ulong num = MySession.Static.Players.TryGetSteamId(pair.Value.PlayerId); if ((num != 0) && (num != MyEventContext.Current.Sender.Value)) { nullable = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_SingleTarget), msg, new EndpointId(num), nullable); } } goto TR_0003; } break; } case 3: break; case 4: playerName = GetPlayerName(MyEventContext.Current.Sender.Value); playerName = GetPlayerName(msg.TargetId); goto TR_0003; default: goto TR_0003; } ulong num2 = MySession.Static.Players.TryGetSteamId(msg.TargetId); if ((num2 != 0) && (num2 != MyEventContext.Current.Sender.Value)) { playerName = GetPlayerName(MyEventContext.Current.Sender.Value); playerName = GetPlayerName(msg.TargetId); nullable = null; Sandbox.Engine.Multiplayer.MyMultiplayer.RaiseStaticEvent <ChatMsg>(s => new Action <ChatMsg>(MyMultiplayerBase.OnChatMessageRecieved_SingleTarget), msg, new EndpointId(num2), nullable); } TR_0003: Sandbox.Engine.Multiplayer.MyMultiplayer.Static.OnChatMessage(ref msg); if (Game.IsDedicated && MySandboxGame.ConfigDedicated.SaveChatToLog) { StringBuilder builder1 = new StringBuilder(); MyLog.Default.WriteLine($"CHAT - channel: [{msg.Channel.ToString()}], from [{playerName}] to [{playerName}], message: '{msg.Text}'"); } }
void OnChatMessage(ref ChatMsg msg, ulong sender) { if (m_memberData.ContainsKey(sender)) { if (m_memberData[sender].IsAdmin) { if (msg.Text.ToLower().Contains("+unban")) { string[] parts = msg.Text.Split(' '); if (parts.Length > 1) { ulong user = 0; if (ulong.TryParse(parts[1], out user)) { BanClient(user, false); } } } } } RaiseChatMessageReceived(sender, msg.Text, ChatEntryTypeEnum.ChatMsg); }
private static void OnChatMessageRecieved_SingleTarget(ChatMsg msg) { Sandbox.Engine.Multiplayer.MyMultiplayer.Static.OnChatMessage(ref msg); }
void OnChatMessage(ref ChatMsg msg, ulong sender) { RaiseChatMessageReceived(msg.Author, msg.Text, ChatEntryTypeEnum.ChatMsg); }