Did you know? elitepvpers has its own image host, epvpimg.com.
[Release]User Delete (Console Commands for 5165)
This is a discussion on [Release]User Delete (Console Commands for 5165) within the CO2 PServer Guides & Releases forum part of the CO2 PServer - Discussions / Questions category; #Fixed but not tested. If fixed, thank you 'notforme'.
Okay so I came up with the idea on doing this ...
#Fixed but not tested. If fixed, thank you 'notforme'.
Okay so I came up with the idea on doing this a while back but I forgot about it. But now I remembered and I've decided to release it.
Function: It deletes the Account or Character from your OldCODB.
Purpose: For lazy people that do not want to go through folders to find what they are looking for to then delete it. Also, a little practice for me in C#.
How can this be improved: Well, I wanted it to be able to delete the Account that ties along with the Character but I do not know how. So I simply made 2 Commands separately for the Console so that you can delete the Account and/or Character. So this could be "improved" if you could just delete the Account and Character in just 1 hit instead of 2.
Requirements: [Only registered and activated users can see links. ]
Credits: I forgot who actually told me how to do this but credits to him/her.
Let's get started.
Open up the Source using C# and in Database.cs find:
Code:
public static void CreateAccount(string Name, string Password, string Status)
{
if (!File.Exists(@"C:\OldCODB\Users\" + Name + ".usr"))
{
FileStream FS = new FileStream(@"C:\OldCODB\Users\" + Name + ".usr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
BW.Write(Password);
BW.Write(Status);
BW.Close();
FS.Close();
}
}
Below that add:
Code:
public static void DeleteAccount(string Name)
{
if (File.Exists(@"C:\OldCODB\Users\" + Name + ".usr"))
{
File.Delete(@"C:\OldCODB\Users\" + Name + ".usr");
}
}
public static void DeleteCharacter(string Name)
{
if (File.Exists(@"C:\OldCODB\Users\Characters\" + Name + ".chr"))
{
File.Delete(@"C:\OldCODB\Users\Characters\" + Name + ".chr");
}
}
public static void DeleteCharacter(string Name)
{
if (File.Exists(@"C:\OldCODB\Users\Characters" + Name + ".usr"))
{
File.Delete(@"C:\OldCODB\Users\Characters" + Name + ".usr");
}
}
to this
Quote:
public static void DeleteCharacter(string Name)
{
if (File.Exists(@"C:\OldCODB\Users\Characters" + Name + ".chr"))
{
File.Delete(@"C:\OldCODB\Users\Characters" + Name + ".chr");
}
}
Uh erm, actually I don't even think I've tested deleting Characters. I made it for Accounts but then I decided it would make sense to make one for both, let me see what's wrong.
#update- Yeah I tried it and I did change from .usr to .chr. That's pretty weird I really do not understand, sorry..