[Question]Ban for 5165

02/20/2010 02:42 copz1337#16
okay btw i get 85 errors i did everything.

"The name 'Database' does not exist in the current context"
and
"Expected class, delegate. enum, interface, or struct"

and some more
02/20/2010 02:48 spare2#17
Quote:
Originally Posted by copz1337 View Post
okay btw i get 85 errors i did everything.

"The name 'Database' does not exist in the current context"
and
"Expected class, delegate. enum, interface, or struct"

and some more
You put it in the wrong place.
You suppose to put the first two methods inside the class. You probably put elsewhere.
02/20/2010 02:58 copz1337#18
Quote:
Originally Posted by spare2 View Post
You put it in the wrong place.
You suppose to put the first two methods inside the class. You probably put elsewhere.
yea but i changed it and still..
02/20/2010 02:59 Arcо#19
Quote:
Originally Posted by copz1337 View Post
yea but i changed it and still..
Where did you put it.
Screenshot please?
02/20/2010 03:02 spare2#20
Quote:
Originally Posted by copz1337 View Post
yea but i changed it and still..
Okay...
Try finding CreateCharacter method and place CheckBan and AddBan right after it. ...
03/15/2010 23:01 pintser#21
Quote:
Originally Posted by spare2 View Post
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.
Where do i make the defenition of CheckBan?
03/16/2010 20:03 walmartboi#22
It's much easier doing this with a MySQL source, since the banned info is right there in the database :)
10/03/2010 11:53 sohaib#23
it worked for my thx very much guys
10/03/2010 20:18 peterpiper99#24
I cannot find:

if (Game.World.H_Chars.Contains(GC.MyChar.EntityID))
10/03/2010 20:19 Arcо#25
People don't bump old threads.