Hello!
My command suggestion:
/infectmessage <add> <param1>:<param2>
/infectmessage <del> <param1>:<param2>
/infectmessage list
What does it do? You can add/remove custom infect messages to the server. e.g. if you wanted to make it say 'Player1 just ate Player2's head for dinner!' when they infect them, then you can. When you get bored of it, you could remove it.
This suggestion would be recommended for admins (obvious reasons), maybe you guys could discuss and have weekly infection message additions and removals, or just add them randomly when you think of a good one. Maybe you could have sections of the forums to suggest infection messages or something too :)
I know the devs can just change the source code to include new messages, but this would save them time in the long run, and make the server a little more unique and interesting, which we would all love :)
I have made the command before, so feel free to look at / modify / use my code below. I hope it can help and I hope you may see the use in this command.
Command:
During map interval & Server start-up
infectMessages and infectMessages2 are the names of the infection message lists. Providing you have the same mechanism as an old MCForge zombie survival game did, then it should stay as it is. Otherwise you may need to modify it slightly. In case you don't use the traditional way, this is what the code looks like (so you can see what is happening with the messages):
Lastly, for anybody confused about how you actually use the command, this is how it works. (Read the text in the code):
My command suggestion:
/infectmessage <add> <param1>:<param2>
/infectmessage <del> <param1>:<param2>
/infectmessage list
What does it do? You can add/remove custom infect messages to the server. e.g. if you wanted to make it say 'Player1 just ate Player2's head for dinner!' when they infect them, then you can. When you get bored of it, you could remove it.
This suggestion would be recommended for admins (obvious reasons), maybe you guys could discuss and have weekly infection message additions and removals, or just add them randomly when you think of a good one. Maybe you could have sections of the forums to suggest infection messages or something too :)
I know the devs can just change the source code to include new messages, but this would save them time in the long run, and make the server a little more unique and interesting, which we would all love :)
I have made the command before, so feel free to look at / modify / use my code below. I hope it can help and I hope you may see the use in this command.
Command:
Code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace BlocktopiaZombies
{
public class CmdInfectMessage : Command
{
public override string name { get { return "infectmessage"; } }
public override string shortcut { get { return "infectmsg" } }
public override string type { get { return "mod"; } }
public override bool museumUsable { get { return true; } }
public override LevelPermission defaultRank { get { return LevelPermission.Admin; } }
public CmdInfectMessage() { }
public override void Help(Player p)
{
Player.SendMessage(p, "/infectmessage [add/del] [before-name-message]:[after-name-message] - Adds an infect message to the server for usage in free for all rounds.");
Player.SendMessage(p, "/infectmessage list - list all current customised infection messages.");
Player.SendMessage(p, "- For an example, type /infectmessage example.");
}
public override void Use(Player p, string message)
{
if (message.Trim().ToLower() == "example")
{
Player.SendMessage(p, "/infectmessage add just gave : an undead sandwhich!");
Player.SendMessage(p, "After using the command, it would appear like this in game:");
Player.SendMessage(p, "When personA infects personB:");
Player.SendMessage(p, "personA just gave personB an undead sandwhich!");
Player.SendMessage(p, "If you wanted to delete this infection message in the future, you could type:");
Player.SendMessage(p, "/infectmessage del just gave : an undead sandwhich!");
}
else if (message.Trim().ToLower() == "list")
{
foreach (string line in File.ReadAllLines("FolderX/infectmsgs.txt"))
{
bool anyThere = false;
if (line.Trim() != "" && line.Trim().IndexOf("#") != 0)
{
anyThere = true;
try
{
Player.SendMessage(p, "'" + line.Trim() + "'"); // Could be modified to be prettier
}
catch { }
}
if (!anyThere)
{
Player.SendMessage(p, "No custom infection messages found.");
}
}
}
else
{
if (message.Trim() == "" || !message.Trim().Contains(" ")) { Player.SendMessage(p, "3"); Help(p); return; }
if (message.Split(' ')[0].ToLower() != "add" && message.Split(' ')[0].ToLower() != "del") { Player.SendMessage(p, "1"); Help(p); return; }
string[] split = message.Split(new char[] { ' ' }, 2);
string check = split[1];
if (check.IndexOf(":") == -1) { Player.SendMessage(p, "2"); Help(p); return; }
string msg1 = check.Substring(0, check.IndexOf(":"));
string msg2 = " ";
try
{
msg2 = check.Substring(check.IndexOf(":") + 1);
}
catch { msg2 = " "; }
try
{
if (split[0].ToLower() == "add")
{
File.AppendAllText("FolderX/infectmsgs.txt", Environment.NewLine + msg1 + ":" + msg2);
Player.SendMessage(p, "Infection message succesfully added. It will be active next round.");
}
else
{
bool anyFound = false;
List<string> toPaste = new List<string>();
foreach (string line in File.ReadAllLines("FolderX/infectmsgs.txt"))
{
if (line.ToLower() != (msg1 + ":" + msg2).ToLower())
{
toPaste.Add(line);
}
else { anyFound = true; }
}
if (!anyFound)
{
Player.SendMessage(p, "Infection message could not be found to be deleted. Are you sure you formatted the command 100% correctly? Remember that whitespaces are included in the infection message.");
}
else
{
File.WriteAllLines("FolderX/infectmsgs.txt", toPaste.ToArray());
Player.SendMessage(p, "The infection message was succesfully deleted.");
}
}
}
catch { Player.SendMessage(p, "An error occured when saving the infection message."); }
}
}
}
}
During map interval & Server start-up
Code:
public static void AddInfectedMessages()
{
if (!File.Exists("FolderX/infectmsgs.txt")) { return; }
foreach (string line in File.ReadAllLines("FolderX/infectmsgs.txt"))
{
if (line.Trim() != "" && line.Trim().IndexOf("#") != 0)
{
if (line.Contains(":"))
{
bool add = true;
string s1 = "ate", s2 = "'s brain"; // just incase something derps... but it won't.
try
{
s1 = " " + line.Split(':')[0].TrimStart();
s2 = line.Split(':')[1];
}
catch { add = false; }
if (add)
{
if (!infectMessages.Contains(s1))
{
infectMessages.Add(s1);
}
if (!infectMessages2.Contains(s2))
{
infectMessages2.Add(s2);
}
}
}
}
}
}
Code:
// player1 just infected player2:
Random r = new Random();
int msg = r.Next(0, infectMessages.Count);
if (infectMessages2[msg].Trim() == "")
{
Player.GlobalMessage(c.red + player1.name + c.yellow + infectMessages[msg] + c.red + player2.name);
}
else if (infectMessages[msg].Trim() == "")
{
Player.GlobalMessage(c.red + player2.name + c.yellow + infectMessages2[msg]);
}
else
{
Player.GlobalMessage(c.red + player1.name + c.yellow + infectMessages[msg] + c.red + player2.name + c.yellow + infectMessages2[msg]);
}
Thank you.Player.SendMessage(p, "/infectmessage add just gave : an undead sandwhich!");
Player.SendMessage(p, "After using the command, it would appear like this in game:");
Player.SendMessage(p, "When personA infects personB:");
Player.SendMessage(p, "personA just gave personB an undead sandwhich!");
Player.SendMessage(p, "If you wanted to delete this infection message in the future, you could type:");
Player.SendMessage(p, "/infectmessage del just gave : an undead sandwhich!");