AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Block Advertising (https://forums.alliedmods.net/showthread.php?t=197331)

Alka 10-01-2012 12:06

Block Advertising
 
2 Attachment(s)
Block Advertising
[REQ]

Description
  • As title suggests this is a plugin for blocking most of the adverts typed in chat. First i want to say that i know there is a similar plugin by JGHG (maybe others? but i don't remember) but this has a different approach. First, it doesn't use RegEx, i know it's powerful and flexible but not as much as this type of plugin needs because of the much cases where it can have false detects. It's based on string manipulation and can be customized in different ways. This plugin aims to block most of the adverts that can be written in chat under different forms (normal, with delimiters, white spaces, symbols, letters and so...) plus it's still in development. Before start to talk and write that something like this already exists or it can be done in a easiest way using RegEx or any other methods you know, try it! Then you may suggest improvements and post possible bugs or false detects. Thank you

Detect
Code:

11.1.1.1
11.1.1.1:20715
11...1...1...1 (or any number of dots)
11/1/1/1
11 / 1 / 1 / 1 (any number of spaces and delimiters)
1/1.2.3/1.2/3 (any combination of delimiters)
11 1 1 1
1 2 3      1 1      3 1    2
22 l 2 l 2 l 2 (l - from leather. It can recognize letters delimiters too)

Remember, it's working for any ip format but if IP it's written without any delimiters like 123.22.4.1, an IP block (3 different blocks) must contain at least 2 digits. If IP it's written with delimiters like 1-2-3/3-1/1/2 then it must contain 3 different digits.

Cvar
  • amx_advblock (Default: "abd") - Plugin mod flags

    Flags
    Code:

    a - Block chat lines that have been detected as advert
    b - Warn player that he made an advert
    c - Kick player if he make more than MAX_WARNINGS adverts (per session)
    d - Log chat lines that have been detected as advert ( Name and Chat line )
    e - Bypass advertise check for admins with BYPASS_FLAG


Changelog
Spoiler


Requirments
Modifications
  • ColorChat Use - If you want to use colors in chat, uncomment the following lines then recompile
    Code:

    #include <colorchat>

    #define USE_COLORCHAT

  • Maximum warnings before kick if you use cvar flag "c"
    Code:

    #define MAX_WARNINGS 3
  • Bypass advertise check on admins with the following flag
    Code:

    #define BYPASS_FLAG ADMIN_RCON

Files
  • advblock_config.ini - Configuration file must be copied into /addons/amxmodx/configs folder
  • advblock_logs.log - Logs file will be created automatically in /addons/amxmodx/logs folder

Find updated plugin HERE

tigo bitties 10-01-2012 12:27

Re: Block Advertising
 
I tested this when you posted it in the request section, good job. :up:

bibu 10-01-2012 12:42

Re: Block Advertising
 
Wow, alka is back.

quilhos 10-01-2012 14:30

Re: Block Advertising
 
Awesome :), thanks for that x)

fysiks 10-01-2012 19:24

Re: Block Advertising
 
Well, all you just did was implement a very small subset of Regex. I highly doubt that this has fewer false positives than a properly formatted RegEx pattern. I'd like to see an efficiency comparison between this and RegEx because have quite a few native calls there for every single letter typed in chat.

Color chat does not work in all games so either remove color chat or change the the plugin to Counter-Strike only.

Neeeeeeeeeel.- 10-01-2012 20:47

Re: Block Advertising
 
Nice plugin:3 I will test it.
GJ

PS: What does this mean?
PHP Code:

enum (<<=1


claudiuhks 10-01-2012 23:23

Re: Block Advertising
 
Quote:

Originally Posted by fysiks (Post 1810773)
Well, all you just did was implement a very small subset of Regex. I highly doubt that this has fewer false positives than a properly formatted RegEx pattern. I'd like to see an efficiency comparison between this and RegEx because have quite a few native calls there for every single letter typed in chat.

Color chat does not work in all games so either remove color chat or change the the plugin to Counter-Strike only.

Yes, removing Color Chat would be a great idea.
I think a Bypass flag is not needed.

Instead of:

PHP Code:

!szText

You may check the length:

PHP Code:

if( strlenszText ) < 

Change Changelog to [ code ], [ quote ] or even [ spoiler ] + [ code ] tag.

Good job!

And the greatest question is: there is no possibility to do that using RegEx?

Quote:

Originally Posted by Neeeeeeeeeel.- (Post 1810820)
PS: What does this mean?
PHP Code:

enum (<<=1


It means an enumeration of bytes.
A byte may be checked with "&" operator.

Swat-inc 10-02-2012 05:32

Re: Block Advertising
 
L 10/02/2012 - 12:31:40: Start of error session.
L 10/02/2012 - 12:31:40: Info (map "fy_pool_day") (file "addons/amxmodx/logs/error_20121002.log")
L 10/02/2012 - 12:31:40: [AMXX] Invalid Plugin (plugin "block_advertising.amxx")

Something wrong with this plugin...

but then i do that plugin works normaly - ColorChat Use - If you don't want to use colors in chat comment the following lines then recompile
Code:
//#include <colorchat> //#define USE_COLORCHAT

Alka 10-02-2012 05:50

Re: Block Advertising
 
Ok. Lets start...

@fysiks - It is like a Regex subset but with more checks. I don't even bother to explain, you can check that yourself...you can make comparisons. If you bother to read about plugin modifications you will see that it can be used without colorchat too and this make it compatible for all games and not only CS.

@claudiuhks - Same about colorchat, just comment 2 lines and don't use it. You can't follow one little advice and modify a file? Really? About strlen() yeah it's a good idea, i will modify it. Code tags are useless for changelog? why would you need that? I will add spoiler tags and that it's enough for shorting the post. BYPASS_FLAG it's there for owners, maybe i want to write any website? make fun of someone? but i don't want to add in the whitelist so that anyone can write it

The greatest answer: do it yourself. I didn't say that it's not possible...just this way i can handle the false detects.

@Swat-inc - Open the log and paste the error here

Swat-inc 10-02-2012 05:54

Re: Block Advertising
 
in logs only this text - but then i do that //#include <colorchat> //#define USE_COLORCHAT and recompiled its works perfect ;)
L 10/02/2012 - 12:03:12: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20121002.log")
L 10/02/2012 - 12:03:12: [AMXX] Invalid Plugin (plugin "block_advertising.amxx")
L 10/02/2012 - 12:10:46: Start of error session.
L 10/02/2012 - 12:10:46: Info (map "de_dust2_2x2") (file "addons/amxmodx/logs/error_20121002.log")
L 10/02/2012 - 12:10:46: [AMXX] Invalid Plugin (plugin "block_advertising.amxx")
L 10/02/2012 - 12:31:40: Start of error session.
L 10/02/2012 - 12:31:40: Info (map "fy_pool_day") (file "addons/amxmodx/logs/error_20121002.log")
L 10/02/2012 - 12:31:40: [AMXX] Invalid Plugin (plugin "block_advertising.amxx")


All times are GMT -4. The time now is 03:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.