Delete Char Command

11/30/2008 19:01 BloodBounty#1
I got tierd of going into mysql to delete and make a new account so heres the code for it.

In Database.cs >>>External<<<
Find
Code:
public static void Ban(string Acc)
above add

Code:
 public static void delete(string Acc)
    {//CreatedbyBloodBounty
        if (ExternalDatabase.AllowQuerys)
            DatabaseQueue.Enqueue(new MySqlCommand("DELETE FROM `Characters`  WHERE `Account` = '" + Acc + "'", Connection));
            DatabaseQueue.Enqueue(new MySqlCommand("UPDATE `Accounts` SET `LogonType` = 2 WHERE `AccountID` = '" + Acc + "'", Connection));
    }
Next to add the commands.

in Client.cs

Find
Code:
if (Message[0] == '/')
                        {
Under it add
Code:
if (Message == "/delete")
                                        {
                                            ExternalDatabase.delete(MyChar.MyClient.Account);
                                            MyChar.MyClient.Drop();
                                        }
and so gms can delete players accounts.

Find
Code:
if (Status == 8)
                                    {
below add.
Code:
if (Splitter[0] == "/deleteban")
                                        {
                                             foreach (DictionaryEntry DE in World.AllChars)
                                            {
                                                Character Char = (Character)DE.Value;

                                                if (Char.Name == Splitter[1])
                                                {
                                                    World.SendMsgToAll(Splitter[1] + " has been Deleted by " + MyChar.Name, "SYSTEM", 2011);
                                                    ExternalDatabase.delete(Char.MyClient.Account);
                                                    Char.MyClient.Drop();
                                                }
                                                 else
                                                {
                                                  SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "Sorry the Character:" + Splitter[1] + " is offline.", 2000));
                                                }
                                             }
11/30/2008 19:20 tao4229#2
Expanding on this...
The delete character request is just a data packet.

under
Code:
case 1010:
of Client.cs

Add this to actually do this from ingame.(The delete button under options)

Code:
case 95:
{
    ExternalDatabase.delete(MyChar.MyClient.Account);
    MyChar.MyClient.Drop();
    break;
}
Other than that, good work!
Edit:: Didn't see i posted twice. Fixed/Deleted.
11/30/2008 19:27 Korvacs#3
Mhmmm, a unique release, congratulations!
11/30/2008 20:04 alexbigfoot#4
great release. anyway i had it working with wh password for like 1 month :D