Server limits chatmessage length and the number of chatmessages written in one packet

This commit is contained in:
Regalis
2017-05-08 19:06:05 +03:00
parent 152a92e600
commit 7dad837733
6 changed files with 47 additions and 16 deletions

View File

@@ -735,6 +735,24 @@ namespace Barotrauma
GameMain.Server.CreateEntityEvent(wall);
}
break;
case "spamchatmessages":
int msgCount = 1000;
if (commands.Length > 1) int.TryParse(commands[1], out msgCount);
int msgLength = 50;
if (commands.Length > 2) int.TryParse(commands[2], out msgLength);
for (int i = 0; i < msgCount; i++)
{
if (GameMain.Server != null)
{
GameMain.Server.SendChatMessage(ToolBox.RandomSeed(msgLength), ChatMessageType.Default);
}
else
{
GameMain.Client.SendChatMessage(ToolBox.RandomSeed(msgLength));
}
}
break;
#endif
case "cleanbuild":
GameMain.Config.MusicVolume = 0.5f;