[Include] Anti Advertisement System - Simple, yet effective! [PAWN VERSION]
#1

Anti Advertisement System
Simple, yet effective! [PAWN VERSION]
Information

This include contains a function which can be used to detect IP Addresses in strings.

Results

000.000.000.000:7777 - 1.
0.0.0.0:7777 - 1.
255.255.255.255:7777 - 1.
PLS COME JOIN SERVER 37____187____22____119 - 1.
PLS COME JOIN SERVER 37 $$$$ 187 $$$$ 22 $$$$ 119 - 1.
0000.000.000.0000:7777 - 0.
255.256.255.255:7777 - 0.
-1.-1.-1.-1:7777 - 1.
-32.-187.-22.-119 - NOTE: REMOVE THE -s AND JOIN NOW! - 1.

0 = An IP address wasn't found - 1 = An IP address was found

I'm happy with the results. But you may be wondering, why are the last 2 IPs detected as valid IPs? Well, it's for more security in my opinion. If a player sends a message like "-32.-187.-22.-119 - NOTE: REMOVE THE -s AND JOIN NOW!" it will go through and logically the player would win the battle and bring all your players onto their server.

Possible Usage
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsAdvertisement(text))
    {
        SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}[ERROR]: {FFFFFF}Your message contains an IP Address (strict detection).");
        return 0;
    }
    return 1;
}
Download

GitHub

Versions

Anti Advertisement System - Simple, yet effective! [REGEX VERSION]

Note

I will organize my GitHub page and fix all my threads here soon. But the code of this release is there in the meanwhile.

And yes, commas are detected as well. Same goes for any other character.
Reply
#2

PAGE NOT FOUND.
Reply
#3

Quote:
Originally Posted by Chesher
Посмотреть сообщение
PAGE NOT FOUND.
same
Reply
#4

Quote:
Originally Posted by RoyalEmpire
Посмотреть сообщение
same
Simply use this one https://sampforum.blast.hk/showthread.php?tid=604086 which might be okay for your needs.
Reply
#5

Use Regular Expression plugin which lot faster and reliable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)