[Release] Ban System [Good One!]

11/18/2008 18:03 _Emme_#1
Okay im back ( yes I know, it hurts .. ) :D

Well,Ima code and release a ban system, which is NOT FOR LOTF, so you actually need to rewrite this ( this might be a good system to get leachers to learn *hopes* ) .

Well,lets start?

First,we add a HashTable, in lotf, add it under AllChars hashtable ( i think, not having a lotf source opened ) .

Code:
public static Hashtable BannedUsers = new Hashtable();

Good,learn how to finally copy paste eh'.

Well,lets move on.


Do a void ( guess where? -.- ) , should look SOMETHING like this but you have to rewrite it, dont think its written in lotf source.


Code:
public void CheckIfBan(GameClient Client)
        {
            if (Everything.BannedUsers.Contains(Client.Username))
            {
                MessageInfo Msg = new MessageInfo("", "ALLUSERS", Color.White, ChatType.Dialog);
                Msg.dwParam = Client.Entity.UID;
                Msg.Message = "Your account : " + Client.Username + " is banned. Please speak to the server admin";
                Client.Send(PacketBuilder.Message(Msg));
            }
        }


Good!

Now, add a command to ban players. Also,this is nothing like LOTF,and this command isnt even done since im written it directly at e*pvp . This is just an example:


Code:
case "/banuser":
                    Everything.BannedUsers.Add(Client.Username, Client);
                    break;


It SHOULD work, not really sure since I tested it once then rewrote it a bit. Anyways this should get some people to learn since this isnt nooby style,lawl,even tho this isnt the best way.

Emme
11/18/2008 18:12 tao4229#2
Just to let you know, the dwParam for messages doesn't need to be the auth/key ID.
I really have no clue what the f*k it is, but you can set it to 0 and it still works.
11/18/2008 19:30 Kiyono#3
Got it working but all it does is DCing the Char
oh well i didn't got compiling errors so that's at least something lol
11/18/2008 19:40 vietkidd510#4
Quote:
Originally Posted by Djago160 View Post
Got it working but all it does is DCing the Char
oh well i didn't got compiling errors so that's at least something lol
make sure that when u make that command it also add a status 3 to the player status..which will cause it to get banned and also you need to make sure status 3 is a banned status in your source
11/18/2008 19:48 tao4229#5
Lol, you have to save the hashtable somehow, otherwise everytime the server goes down, the ban will go away.
11/18/2008 20:03 Sorsha#6
I like this one, would use it but i just restarted my project again. Best whishes

Edit: Well the way i would do it would make a warning system/jail system
1=Warned and Char gets jailed for a day.
2=Gm warns him, he is banned for a day.
3=Char is jail for week.
4=Char Banned and the person can have a chance to appeal.
KMA - /rape tao4429
Sammi
11/18/2008 20:18 Kiyono#7
Well i was just trying to see if i could "change" it to work
the ban command i have (which is already released) is this :

Code:
                                        if (Splitter[0] == ".ban")
                                        {
                                            foreach (DictionaryEntry DE in World.AllChars)
                                            {
                                                Character Char = (Character)DE.Value;

                                                if (Char.Name == Splitter[1])
                                                {
                                                    DataBase.Ban(Char.MyClient.Account);
                                                    Char.MyClient.Drop();
                                                }
                                            }
                                        }
and there is something in the DB but to lazy to copy and paste that but this works
11/18/2008 20:24 KraHen#8
Djago - ruining the fun... -.-
11/18/2008 20:50 Kiyono#9
Quote:
Originally Posted by ElDeRnEcRo View Post
Djago - ruining the fun... -.-
It doesn't work with just the command...

And i didn't provided the DataBase.Ban(Char.MyClient.Account);
11/18/2008 21:06 _Emme_#10
If anyone wonders,this is what it do:

When you login, it checks if your character's username is in the BannedUser's hashtable. If it is, it disconnect and instead of "Connection to the server interupted" or whatever it is, it say this:

"Your account USERNAME has been banned. Speak to admin about this"

So,it replace the normal disconnect message to that one,which I think is great,disagree if you like.
11/18/2008 21:10 © Haydz#11
Should just add a banned bool into the accounts table and check it at login, no need for a hash then
11/18/2008 21:21 _Emme_#12
That's true,never thought of that.