Register for your free account! | Forgot your password?

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

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

Advertisement



[Question]Ban for 5165

Discussion on [Question]Ban for 5165 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 [Question]Ban for 5165

I've been thinking of making a ban command for my 5165 server but I don't know where I should put the code (not the command but the actual function code). So if anyone knows, step up blez.
copz1337 is offline  
Old 02/19/2010, 22:02   #2
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Quote:
Originally Posted by copz1337 View Post
I've been thinking of making a ban command for my 5165 server but I don't know where I should put the code (not the command but the actual function code). So if anyone knows, step up blez.
Try making a definition in character.cs and then adding it to the save/load/create char sequences.
Code:
public byte Ban = 0;
Then make a command somewhat like this:
Code:
                    if (Cmd[0] == "/ban")
                    {
                        Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                        if (C != null)
                            C.Ban += 1;
                    }
Then go to the load char sequence and under C.Loaded = true;
put something like if (C.Ban >0) C.Disconnect;
get it?
Arcо is offline  
Thanks
2 Users
Old 02/19/2010, 22:32   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
kk i'll try
copz1337 is offline  
Old 02/19/2010, 22:41   #4
 
LetterX's Avatar
 
elite*gold: 20
Join Date: May 2007
Posts: 1,125
Received Thanks: 332
Quote:
Originally Posted by .Arco View Post
Try making a definition in character.cs and then adding it to the save/load/create char sequences.
Code:
public byte Ban = 0;
Then make a command somewhat like this:
Code:
                    if (Cmd[0] == "/ban")
                    {
                        Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                        if (C != null)
                            C.Ban += 1;
                    }
Then go to the load char sequence and under C.Loaded = true;
put something like if (C.Ban >0) C.Disconnect;
get it?
Or, to be more efficient, only add the "Ban=" (or whatever) string in the Character file once you use "/ban <name>". And then let the Auth thread check if the character is banned when it is checking acc/pass. More efficient than the auth okaying acc and then game loads all the stats and then finally reads that and then has to end the client's connection. X.x
LetterX is offline  
Old 02/19/2010, 22:43   #5
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Quote:
Originally Posted by LetterX View Post
Or, to be more efficient, only add the "Ban=" (or whatever) string in the Character file once you use "/ban <name>". And then let the Auth thread check if the character is banned when it is checking acc/pass. More efficient than the auth okaying acc and then game loads all the stats and then finally reads that and then ends the client connection. X.x
Gotta point :/
Didn't really think of that.
Arcо is offline  
Old 02/19/2010, 22:51   #6
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
k confused @ this now
copz1337 is offline  
Old 02/19/2010, 23:21   #7
 
ramix's Avatar
 
elite*gold: 0
Join Date: Aug 2008
Posts: 272
Received Thanks: 61
me too xD
ramix is offline  
Old 02/20/2010, 00:33   #8


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
LetterX is quite rightly saying that if you modified AuthWorker.cs, specifically:

Code:
                        if (Info.LogonType != 255)
                        {

                            byte[] IV = new byte[8];
                            for (int i = 0; i < 8; i++)
                                IV[i] = (byte)Rnd.Next(255);

                            KeyedClients.Add(BitConverter.ToUInt64(IV, 0), Info);


                            AC.Send(Packets.SendAuthentication(GameIP, IV));
                            //AC.Disconnect();
                        }
                        else
                        {
                            AC.Send(Packets.WrongAuth());
                            //AC.Disconnect();
                        }
Then you could do this for example:

Code:
                        if (Info.LogonType != 255)
                        {
                            if (Info.LogonType == 3)//Banned
                            {
                                AC.Send(Packets.BannedAuth());//Example!
                                AC.Disconnect();
                            }
                            byte[] IV = new byte[8];
                            for (int i = 0; i < 8; i++)
                                IV[i] = (byte)Rnd.Next(255);

                            KeyedClients.Add(BitConverter.ToUInt64(IV, 0), Info);


                            AC.Send(Packets.SendAuthentication(GameIP, IV));
                            //AC.Disconnect();
                        }
                        else
                        {
                            AC.Send(Packets.WrongAuth());
                            //AC.Disconnect();
                        }
This would require modifiying the layout of the .usr files to incorporate a bool (banned/not banned), and modifying the database backend so that durring authorization:

Code:
                        AuthInfo Info = Database.Authenticate(Account, Password);
The server would check this bool and return 3 for the LogonType if banned.
Korvacs is offline  
Old 02/20/2010, 02:11   #9
 
spare2's Avatar
 
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
Okay, make sure you following the directions below step by step and carefully.
First go to Database.cs and put the following code inside the Database class.
Code:
        public static bool CheckBan(string Name)
        {
            if (File.Exists(@"C:\OldCODB\banname.txt"))
            {
                TextReader tr = new StreamReader(@"C:\OldCODB\banname.txt");//You can change to where ever your OldCODB is
                string name;
                while ((name = tr.ReadLine()) != null)
                {
                    if (name == Name)
                    {
                        return true;
                    }
                }
                tr.Close();
            }
            return false;
        }
        public static void AddBan(string Name)
        {
            if (!CheckBan(Name))
            {
                TextWriter tw = new StreamWriter(@"C:\OldCODB\banname.txt");//You can change to where ever your OldCODB is
                tw.WriteLine(Name);
                tw.Close();
            }

        }
Then find the following line in your project:
Code:
GC.Soc = StO.Sock;
And put this code under it:
Code:
                                if (GC.AuthInfo.LogonType == 3)
                                {
                                    GC.AddSend(Packets.SystemMessage(GC.MessageID, "You are banned!"));
                                }
Then find
Code:
public bool Ghost = false;
Put this below it
Code:
public string AccountName;
Next, find
Code:
if (Game.World.H_Chars.Contains(GC.MyChar.EntityID))
And place this above it
Code:
GC.MyChar.AccountName = Acc;
Then find the following line (make sure you don't use the one that's commented)
Code:
Info.LogonType = 1;
Place this under
Code:
                        if (CheckBan(RealAccount))
                            Info.LogonType = 3;
Finally place this command in the chat commands
Code:
                        if (Cmd[0] == "/ban")
                        {
                            Game.Character C = Game.World.CharacterFromName(Cmd[1]);
                            if (C != null)
                                Database.AddBan(C.AccountName);
                                C.MyClient.Disconnect();
                        }
I have tested it personally.
spare2 is offline  
Thanks
7 Users
Old 02/20/2010, 02:14   #10


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
You forgot to use your CheckBan method spare =o
Korvacs is offline  
Thanks
1 User
Old 02/20/2010, 02:16   #11
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,922
Received Thanks: 491
he used once in the AddBan function
PeTe Ninja is offline  
Old 02/20/2010, 02:18   #12
 
spare2's Avatar
 
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
Yea I forgot to put it in the post, I edited it now. Thanks Korvacs.
spare2 is offline  
Old 02/20/2010, 02:32   #13
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
alright how do i unban then
copz1337 is offline  
Old 02/20/2010, 02:33   #14
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,765
Received Thanks: 5,291
Quote:
Originally Posted by copz1337 View Post
alright how do i unban then
Delete them from the text file.
Arcо is offline  
Thanks
1 User
Old 02/20/2010, 02:35   #15
 
spare2's Avatar
 
elite*gold: 20
Join Date: Oct 2009
Posts: 1,009
Received Thanks: 621
Quote:
Originally Posted by copz1337 View Post
alright how do i unban then
Find the person's account name and delete that entire line.
spare2 is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
Question about a code (5165)
08/23/2010 - CO2 Private Server - 3 Replies
SERVER 5165 LOTF Well, what this npc is suppose to do in order is: Check if you have 50k cps or more, check if you are level 130 or more, check if you are level 137 or less (so check if your between level 130-137 and also checks if you have 50k or more cps). If true, the npc takes away 50k cps from your inventory, and adds a level and broadcasts that you bought a lvl. Otherwise, it gives an error message. But I'm getting 2 errors on the line where "else" is which are "Invalid Expression...
[5165]Question...
06/16/2010 - CO2 Private Server - 3 Replies
Can i add in 5165 to make allies , enemies and to change the buletin? can i add that or it`s imposible :D ?
[Question] how to changes npc name (5165)
05/17/2010 - CO2 Private Server - 3 Replies
hi guys , who can tell on how to changes the npc name?
One question about 5165
05/03/2010 - CO2 Private Server - 4 Replies
Today I was playing with my archer on my 5165 private server and he is the GM i was looking through the gm commands and i seen counter kill so I typed it in and there it was in my skill list i made counter kill active attacked a guard and the attack was countered. So the skill works and is already in the source without me adding it. But I can't find where to get it on my normal ninja char in game. Where do you find counter kill? or how can I give it to a existing npc so when you talk to him he...
[QUESTION]About NPC and IDs (5165)
12/02/2009 - CO2 Private Server - 9 Replies
Can someone give me IDs for ninja gear for the 5165 source? And also can someone tell me what number represents the + on the item below: Thanks.



All times are GMT +2. The time now is 09:13.


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.