Hacked clients can't send chat messages from other characters anymore

Also added sendername as userdata in chat messages, for now it's not used for anything but we'll probably find something where this is useful
This commit is contained in:
juanjp600
2016-08-30 17:35:58 -03:00
parent 07398be97e
commit 52270e3a35
7 changed files with 73 additions and 45 deletions

View File

@@ -1443,6 +1443,7 @@ namespace Barotrauma.Networking
{
Client sender = connectedClients.Find(x => x.Connection == inc.SenderConnection);
ChatMessage message = ChatMessage.ReadNetworkMessage(inc);
if (message == null) return;
List<Client> recipients = new List<Client>();
@@ -1494,7 +1495,7 @@ namespace Barotrauma.Networking
if (similarity > 5.0f)
{
sender.ChatSpamCount++;
if (sender.ChatSpamCount > 3)
{
//kick for spamming too much
@@ -1633,10 +1634,10 @@ namespace Barotrauma.Networking
headSpriteId = 0;
}
if (sender.characterInfo != null)
{
//clients can't change their character's name once it's been set
name = sender.characterInfo.Name;
if (sender.characterInfo != null)
{
//clients can't change their character's name once it's been set
name = sender.characterInfo.Name;
}
List<JobPrefab> jobPreferences = new List<JobPrefab>();