[LOTF RELEASE] Ip Ban!!

05/15/2009 21:38 PeTe Ninja#1
Ip Ban!

Credits to Ultimatum



First...Search this ( It is in General.cs )



Code:
        public static System.IO.StreamWriter sw = new System.IO.StreamWriter(Application.StartupPath + @"\ServerLog.txt", true);

and under it add...


Code:
public static string BannedIP = System.IO.File.ReadAllText(Application.StartupPath + @"\IPBanList.txt");
Next search for this ( Still in General.cs ( all of it is )

Code:
if (Auth != 0)
                        {
                            General.WriteLine("Successful login for account " + ThisAcc);
and replace it with

Code:
  if (Auth != 0)
                        {
                            if (BannedIP.Contains(Ip))
                            {
                                Socket.Disconnect();
                            }
                            Console.ForegroundColor = ConsoleColor.Blue;
                            General.WriteLine("Successful login for account " + ThisAcc + " IP: " + Ip);
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.White;
Now go in your debug folder and create a TEXT document ( notepad file )

called IPBanList

Now when someone logins to your server you will see their account name and also their IP so just put the ip in the text document

ONE IP PER LINE!!!

and save it and restart server and that person will not be able to login :D

if this doesnt work please tell me and i will see why :D

even though this is Ultimatums press thanks if this helped and if he posts here then press thanks to him instead of me!
05/15/2009 21:52 martoon#2
The first thanks =], and i hope you will add the command soon.
05/15/2009 21:53 PeTe Ninja#3
Quote:
Originally Posted by martoon View Post
The first thanks =], and i hope you will add the command soon.
working on it :D...i dont remember how to read ini from client.cs so im trying to remember
05/15/2009 21:53 martoon#4
I will be waiting =D
05/15/2009 21:58 danielachraf#5
It looks better than mine .. :D
05/15/2009 22:14 PeTe Ninja#6
emme is making the command i think...i hope he is atleast i asked him for help on msn so if he makes it ill post here
05/15/2009 23:35 ih8you#7
nice pete +k =]
05/16/2009 02:24 Vortex.#8
Thank you..

Hope your still not mad at me
05/16/2009 03:53 AndreaCo#9
pete if emme doesent code in command i will do it.. its easy... just pm me on msn and il do it
05/16/2009 04:32 superplox#10
i swear this has been released before...
05/16/2009 04:36 Ultimatum#11
Wow this is old and it still got thanks LOL

Quote:
Originally Posted by superplox View Post
i swear this has been released before...
It as, read the post...
05/16/2009 05:53 PeTe Ninja#12
Quote:
Originally Posted by AndreaCo View Post
pete if emme doesent code in command i will do it.. its easy... just pm me on msn and il do it
make for me...emme coudnt figure it out i dont thikn he had enough time
05/16/2009 07:21 alexbigfoot#13
Code:
  if (Auth != 0)
                        {
                            if (BannedIP.Contains(Ip))
                            {
                                Socket.Disconnect();
                               [B] return;[/B]
                            }
                            Console.ForegroundColor = ConsoleColor.Blue;
                            General.WriteLine("Successful login for account " + ThisAcc + " IP: " + Ip);
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.White;
05/16/2009 09:10 PeTe Ninja#14
Quote:
Originally Posted by alexbigfoot View Post
Code:
  if (Auth != 0)
                        {
                            if (BannedIP.Contains(Ip))
                            {
                                Socket.Disconnect();
                               [B] return;[/B]
                            }
                            Console.ForegroundColor = ConsoleColor.Blue;
                            General.WriteLine("Successful login for account " + ThisAcc + " IP: " + Ip);
                            Console.ResetColor();
                            Console.ForegroundColor = ConsoleColor.White;
can you tell me why it needs return? im not argueing i just want to know what it does
05/16/2009 11:45 _Emme_#15
It was around 2 AM haha, and it was ages ago I touched LOTF.
Anyhow, go ahead and make a command (speaking to anyone), because I wont, developing my own game from scratch =P

Regards,
Emme