Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 02:44

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



How can I make this command do the Opposite?

Discussion on How can I make this command do the Opposite? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Post How can I make this command do the Opposite?

How can I change this command to delete an account in my folder of Users instead of creating?

Code:
                    if (Cmd[0] == "/newacc" && Cmd.Length > 2)
                    {
                        if (Cmd.Length == 3)
                            Database.CreateAccount(Cmd[1], Cmd[2], "");
                        else
                            Database.CreateAccount(Cmd[1], Cmd[2], Cmd[3]);
                    }
copz1337 is offline  
Old 01/29/2010, 21:54   #2
 
elite*gold: 0
Join Date: Jan 2010
Posts: 116
Received Thanks: 33
You can't.
Jedex is offline  
Old 01/29/2010, 22:47   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Quote:
Originally Posted by Jedex View Post
You can't.
That doesn't help. I don't listen to people that say "You can't do it".
copz1337 is offline  
Old 01/29/2010, 23:14   #4
 
elite*gold: 0
Join Date: Sep 2008
Posts: 178
Received Thanks: 62
Yes, you can obviously -.-
.Kob is offline  
Old 01/29/2010, 23:37   #5


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
You would need to write a new DeleteAccount method which would remove an account from your database.

And then write a new command for it.
Korvacs is offline  
Old 01/29/2010, 23:57   #6
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Quote:
Originally Posted by Jedex View Post
You can't.
You don't know anything about c# to be honest so you have no right to say that.

@OP
Make it find the account from the accounts folder and delete it.
Does that help?
Arcо is offline  
Old 01/30/2010, 00:15   #7
 
spare2's Avatar
 
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
Code:
        public static void DeleteAccount(string Name)
        {
            if (File.Exists(@"C:\OldCODB\Users\" + Name + ".usr"))
            {
                File.Delete(@"C:\OldCODB\Users\" + Name + ".usr");
            }
        }
Code:
                    if (Cmd[0] == "/delacc" && Cmd.Length > 1)
                    {
                        Database.DeleteAccount(Cmd[1]);
                    }
spare2 is offline  
Thanks
1 User
Old 01/30/2010, 00:21   #8
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by spare2 View Post
Code:
        public static void DeleteAccount(string Name)
        {
            if (File.Exists(@"C:\OldCODB\Users\" + Name + ".usr"))
            {
                File.Delete(@"C:\OldCODB\Users\" + Name + ".usr");
            }
        }
Code:
                    if (Cmd[0] == "/delacc" && Cmd.Length > 1)
                    {
                        Database.DeleteAccount(Cmd[1]);
                    }
Owned,? Looks like it would work,
-Shunsui- is offline  
Thanks
1 User
Old 01/30/2010, 00:47   #9
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Yeah I'll try that command in a sec. Anyways I found this on google. Haven't tested either oh well.

#edit- yeah the command worked, thanks Spare2.

Code:
// Simple synchronous file deletion operations with no user interface.
// To run this sample, create the following files on your drive:
// C:\Users\Public\DeleteTest\test1.txt
// C:\Users\Public\DeleteTest\test2.txt
// C:\Users\Public\DeleteTest\SubDir\test2.txt

public class SimpleFileDelete
{
    static void Main()
    {
        // Delete a file by using File class static method...
        if(System.IO.File.Exists(@"C:\Users\Public\DeleteTest\test.txt"))
        {
            // Use a try block to catch IOExceptions, to
            // handle the case of the file already being
            // opened by another process.
            try
            {
                System.IO.File.Delete(@"C:\Users\Public\DeleteTest\test.txt");
            }
            catch (System.IO.IOException e)
            {
                Console.WriteLine(e.Message);
                return;
            }
        }

        // ...or by using FileInfo instance method.
        System.IO.FileInfo fi = new System.IO.FileInfo(@"C:\Users\Public\DeleteTest\test2.txt");
        try
        {
            fi.Delete();
        }
        catch (System.IO.IOException e)
        {
            Console.WriteLine(e.Message);
        }

        // Delete a directory. Must be writable or empty.
        try
        {
            System.IO.Directory.Delete(@"C:\Users\Public\DeleteTest");
        }
        catch (System.IO.IOException e)
        {
            Console.WriteLine(e.Message);
        }
        // Delete a directory and all subdirectories with Directory static method...
        if(System.IO.Directory.Exists(@"C:\Users\Public\DeleteTest"))
        {
            try
            {
                System.IO.Directory.Delete(@"C:\Users\Public\DeleteTest", true);
            }

            catch (System.IO.IOException e)
            {
                Console.WriteLine(e.Message);
            }
        }

        // ...or with DirectoryInfo instance method.
        System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(@"C:\Users\Public\public");
        // Delete this dir and all subdirs.
        try
        {
            di.Delete(true);
        }
        catch (System.IO.IOException e)
        {
            Console.WriteLine(e.Message);
        }

    }
}
copz1337 is offline  
Reply


Similar Threads Similar Threads
[5165] make it full command?
01/29/2010 - CO2 Private Server - 13 Replies
:confused: how could i just make it so all accounts can do commands for items and also how to make a guard reviver if any1 would happen 2 know? :D
How do you make a monster spawn with a command?
01/10/2010 - CO2 Private Server - 19 Replies
Is there a way to spawn a monster with a command in game (instantly), maybe like Gano or Titan? Also is it possible to remove that monster after x amount of time? So far I have already gotten the Timer and spawned the monster on server start but I want to be able to command when I want to spawn the monster. Thanks.
Anyone can make Gm command for this server ?
11/16/2009 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 1 Replies
CABAL Online MMoGreat.COM!!! or tell my be pm how to find this addresses ? and what to do with value ?
make OOG bot buff on command
10/12/2008 - Lineage 2 - 3 Replies
hello. i am curios about something. is it possible to ma make a bot do a special action when hi gets a pm, or gets invited by a specific char ? example 1: if i invite a bd in party, hi will do fighter dances (dances that i set) example 2: if i pm a pp, hi will buff me some buffs any ideas ?



All times are GMT +2. The time now is 02:44.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.