Chat Filter example

Re: Chat Filter example

Postby creativemagic » 09 Apr 2012, 14:20

ok, so I added the references MCDzienny_.dll and MySql.Data.dll, and chose System.Data from .NET
I feel like i;m missing a obvious step. I can't seem to find that huge compile button (sarcasm)
Owner of...
[Exclusive] Lava Survival
User avatar
creativemagic
 
Posts: 214
Joined: 12 Nov 2011, 20:26

Re: Chat Filter example

Postby dzienny » 09 Apr 2012, 17:50

creativemagic wrote:ok, so I added the references MCDzienny_.dll and MySql.Data.dll, and chose System.Data from .NET
I feel like i;m missing a obvious step. I can't seem to find that huge compile button (sarcasm)


References to MCDzienny_.dll would be sufficient, because MySql.Data.dll etc. are used for MySQL database access, still you can leave it this way. Now when you have the reference added build the solution(Build -> Build Solution). And there you are, you got a compiled dll library. If you don't know where the file was created look at Output window(View -> Output), you should find there a full path to your compilation. Copy the file to 'extra\commands\dll' , rename it to Cmd[command name].dll and use /cmdload [command name]. Also you can add the command to '\text\cmdautoload.txt' file, so that it will be loaded automatically when the software starts.
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: Chat Filter example

Postby creativemagic » 12 Apr 2012, 12:42

Thanks ! It works now. I did have to enable the expert settings Tools>settings>Expert settings to make the "Build" tab show, but then it all worked.
Owner of...
[Exclusive] Lava Survival
User avatar
creativemagic
 
Posts: 214
Joined: 12 Nov 2011, 20:26

Re: Chat Filter example

Postby creativemagic » 15 Apr 2012, 13:17

Code: Select all
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }

What would you have to change in order to allow OP+ to bypass the chatfilter in the normal chat?
Owner of...
[Exclusive] Lava Survival
User avatar
creativemagic
 
Posts: 214
Joined: 12 Nov 2011, 20:26

Re: Chat Filter example

Postby Ultima » 16 Apr 2012, 08:51

Filter isn't made to bypass anything.
You should add a check if permission < OP around the whole command.
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

Re: Chat Filter example

Postby dzienny » 16 Apr 2012, 20:36

creativemagic wrote:
Code: Select all
public override LevelPermission defaultRank { get { return LevelPermission.Banned; } }

What would you have to change in order to allow OP+ to bypass the chatfilter in the normal chat?


It's easy, like Ultima said you have to write a code that checks player rank. For example:
Code: Select all
if (p.group.Permission >= LevelPermission.Operator)
                    return;

Add the above code at the beginning at FilterChat method. So it will look similar to this:
Code: Select all
private void FilterChat(Player p, ref string message, ref bool stopIt)
{
       if (p.group.Permission >= LevelPermission.Operator)
                 return;

       [the rest of the code...]
}
User avatar
dzienny
Administrator
 
Posts: 1181
Joined: 23 Jan 2011, 14:27

Re: Chat Filter example

Postby creativemagic » 22 Apr 2012, 17:14

^ I'll try that.
Owner of...
[Exclusive] Lava Survival
User avatar
creativemagic
 
Posts: 214
Joined: 12 Nov 2011, 20:26

Re: Chat Filter example

Postby LogicaLucidity » 29 Nov 2012, 14:53

I wanted to thank everyone in this thread.

I very much appreciate your work.

-Logic
- [Logic] Lava Survival -
User avatar
LogicaLucidity
 
Posts: 104
Joined: 17 Oct 2011, 09:36

Re: Chat Filter example

Postby toystory_justin » 17 Jan 2013, 14:51

where to add the chat filter? is it like a cmd where u save the code in extra>commands>source folder?
toystory_justin
 
Posts: 224
Joined: 11 Nov 2012, 07:12
Location: On a dark place

Re: Chat Filter example

Postby Ultima » 09 Feb 2013, 11:35

toystory_justin wrote:where to add the chat filter? is it like a cmd where u save the code in extra>commands>source folder?


The DDL goes into extra > commands > ddl
The source goes into extra > commands > source

If you only have the source, run "compile <filename>" first.

To load the file type "cmdload <filename>"
User avatar
Ultima
 
Posts: 953
Joined: 19 Aug 2011, 23:45

PreviousNext

Return to Knowledge Base

Who is online

Users browsing this forum: No registered users and 1 guest

cron