Leeizazombie wrote:Thanks! But I'm not great with text files, I'd love to learn, like I have a certain problem with my /autokick command
StreamReader to read files. StreamWriter to write files. Ismellike has good examples of it in his commands.
For example(this is not full code of course, that's your business.):
- Code: Select all
using (StreamWriter write = new StreamWriter(path))
{
write.Write(stuffalreadyreaded);
write.WriteLine(e.Player.name + " " + date);
}
// And here the code for getting stuff
string[] lines;
using (StreamReader read = new StreamReader(path))
{
lines = read.ReadToEnd().Split(new string[] { Environment.NewLine }, StringSplitOptions.None); // Split per newline
}
foreach (string s in lines)
{
string[] words = s.Split(' ');
if (s.Length < 2) continue;
if (s[0] == e.Player.Name && s[1] == date) return;
}
e.Player.money += 30; // Give the player money
Of course, this file is not self-maintaining, it keeps growing and growing. But it's at least something.