[Include] Anti Advertising
#1

Continuing my discussion thread at http://forum.sa-mp.com/showthread.ph...58#post3679258

FEATURES:

This include searches for IPs in strings.

The function searches for numbers ranging from 0-255 in a string. If it atleast 4 of these, then the string contains an IP.

USAGE:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(stringContainsIP(text)) {
        SendClientMessage(playerid, "Text blocked for advertising.");
        return 0;
    }
    return 1;
}

SYTNAX:

stringContainsIP(const szStr[], bool:fixedSeparation = false, bool:ignoreNegatives = false, bool:ranges = true);
  1. bool:ignoreNegatives:
    • By default, it will detect negative numbers as IPs also.
    • So, if false "-1.-1.-1.-1" would be an IP. If true, "-1.-1.-1.-1" would not be an IP.

TEST RESULTS:

pawn Код:
[31/03/2016 10:14:05][05/04/2016 17:50:10] 000.000.000.000 - 1.

[05/04/2016 17:50:10] 0.0.0.0 - 1.

[05/04/2016 17:50:10] 127.0.0.1 - 1.

[05/04/2016 17:50:10] 127  .  0.  0.  1:  7777 - 1.

[05/04/2016 17:50:10] 255.255.255.255 - 1.

[05/04/2016 17:50:10] PLS COME JOIN SERVER 37____187____22____119 - 1.

[05/04/2016 17:50:10] PLS COME JOIN SERVER 37 $$$$ 187 $$$$ 22 $$$$ 119 - 1.

[05/04/2016 17:50:10] -32.-187.-22.-119 - NOTE: REMOVE THE -s AND JOIN NOW! - 1.

[05/04/2016 17:50:10] 255-255-255-255:7777 - 1.

[05/04/2016 17:50:10] -1.-1.-1.-1 - 1.

[05/04/2016 17:50:10] 0000.000.000.0000 - 0.

[05/04/2016 17:50:10] 255.256.255.255 - 0.

[05/04/2016 17:50:10] 1-1.1-1.1-1.1-1 - 1.
DOWNLOAD:
https://github.com/karimcambridge/samp-anti-advertising

CREDITS:

RyDer` for base function.

DISCLAIMER:

Use regex for better results.
Reply
#2

It's useful, thanks, it'll help!
Reply
#3

What about commas?

Example:

255, 255.255, 255:7777

or:

255,255,255.255;7777
Reply
#4

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
What about commas?

Example:

255, 255.255, 255:7777

or:

255,255,255.255;7777
It detects those.
Reply
#5

Great, release before today i always used regex.
Reply
#6

Update: Added an option to ignore negative numbers. Commit: https://github.com/Kar2k/samp-anti-a...6041366c17e54c
Reply
#7

What about detection of domain name as IP (eg: samp.example.net:7777).
Reply
#8

Код:
255-255-255-255:7777
Don't detect.
Reply
#9

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
Код:
255-255-255-255:7777
Don't detect.
stringContainsIP(const szStr[], bool:ignoreNegatives = false);

bool:ignoreNegatives:
By default, it will detect negative numbers as IPs also.
So, if false "-1.-1.-1.-1" would be an IP. If true, "-1.-1.-1.-1" would not be an IP.
Reply
#10

Still don't work..
Reply
#11

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
Still don't work..
Well, this one does: https://sampforum.blast.hk/showthread.php?tid=604097

#NO_TRASHING_TOPIC
Reply
#12

great script, but it has to block dns ips too like server.roleplay.com:7777
Reply
#13

Quote:
Originally Posted by sheNdjze
Посмотреть сообщение
great script, but it has to block dns ips too like server.roleplay.com:7777
Since it contains ":7777" I think that it will blocked anyway, but in case you want to block that domains then you will need to block every domain and it will may be a problem
Reply
#14

Quote:
Originally Posted by JokeyL
Посмотреть сообщение
Код:
255-255-255-255:7777
Don't detect.
Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Well, this one does: https://sampforum.blast.hk/showthread.php?tid=604097

#NO_TRASHING_TOPIC
Works now.


[05/04/2016 17:12:17] 255-255-255-255:7777 - 1.

Fixed in https://github.com/Kar2k/samp-anti-a...b690a7b26728a4
Reply
#15

Added an option to check for fixed separation between ip numbers. Enabled by default.

Meaning 127 ....... 0. 1. 1. is not a valid IP but 127.0.1.1 is a valid
IP.

If you have people speaking etc in your server, you should leave this on
by default.

https://github.com/Kar2k/samp-anti-a...50151c64b769e9
Reply
#16

UPDATE!

- Disabled fixed seperation by default.
- Added support for ranges.
- Added support for numbers such as 0255 or 0005 (technically people can use this to advertise E.G (join my server at 0192. 0169 .0094.030.. and tell them to take out the 0s which would then be 192.169.94.30)

pawn Код:
[12/02/2017 23:00:27] 000.000.000.000 - 1.

[12/02/2017 23:00:27] 0000.000.000.0000 - 1.

[12/02/2017 23:00:27] 0052.255.255.0000 - 1.

[12/02/2017 23:00:27] 0.0.0.0 - 1.

[12/02/2017 23:00:27] 127.0.0.1 - 1.

[12/02/2017 23:00:27] 127  .  0.  0.  1:  7777 - 1.

[12/02/2017 23:00:27] 255.255.255.255 - 1.

[12/02/2017 23:00:27] PLS COME JOIN SERVER 37____187____22____119 - 1.

[12/02/2017 23:00:27] PLS COME JOIN SERVER 37 $$$$ 187 $$$$ 22 $$$$ 119 - 1.

[12/02/2017 23:00:27] -32.-187.-22.-119 - NOTE: REMOVE THE -s AND JOIN NOW! - 1.

[12/02/2017 23:00:27] 255-255-255-255:7777 - 1.

[12/02/2017 23:00:27] -1.-1.-1.-1 - 1.

[12/02/2017 23:00:27] *.*.*.* - 1.

[12/02/2017 23:00:27] 255.*.*.* - 1.

[12/02/2017 23:00:27] 255.255.*.* - 1.

[12/02/2017 23:00:27] 255.255.255.* - 1.

[12/02/2017 23:00:27] 1-1.1-1.1-1.1-1 - 1.

[12/02/2017 23:00:27] ana oltlo gam3 al 11.5m ra7 2ly gm3thom b3ad keda oltlo gam3 12m 2ly gm3thom fa olto gam3 12.5 - 1.

[12/02/2017 23:00:27] 255.256.255.255 - 0.

[12/02/2017 23:00:27] 0052.255.255.1231 - 0.
https://github.com/karimcambridge/sa...daf6b0b4d624cd
Reply
#17

Quote:
Originally Posted by Kar
Посмотреть сообщение
UPDATE!

- Disabled fixed seperation by default.
- Added support for ranges.
- Added support for numbers such as 0255 or 0005 (technically people can use this to advertise E.G (join my server at 0192. 0169 .0094.030.. and tell them to take out the 0s which would then be 192.169.94.30)

pawn Код:
[12/02/2017 23:00:27] 000.000.000.000 - 1.

[12/02/2017 23:00:27] 0000.000.000.0000 - 1.

[12/02/2017 23:00:27] 0052.255.255.0000 - 1.

[12/02/2017 23:00:27] 0.0.0.0 - 1.

[12/02/2017 23:00:27] 127.0.0.1 - 1.

[12/02/2017 23:00:27] 127  .  0.  0.  1:  7777 - 1.

[12/02/2017 23:00:27] 255.255.255.255 - 1.

[12/02/2017 23:00:27] PLS COME JOIN SERVER 37____187____22____119 - 1.

[12/02/2017 23:00:27] PLS COME JOIN SERVER 37 $$$$ 187 $$$$ 22 $$$$ 119 - 1.

[12/02/2017 23:00:27] -32.-187.-22.-119 - NOTE: REMOVE THE -s AND JOIN NOW! - 1.

[12/02/2017 23:00:27] 255-255-255-255:7777 - 1.

[12/02/2017 23:00:27] -1.-1.-1.-1 - 1.

[12/02/2017 23:00:27] *.*.*.* - 1.

[12/02/2017 23:00:27] 255.*.*.* - 1.

[12/02/2017 23:00:27] 255.255.*.* - 1.

[12/02/2017 23:00:27] 255.255.255.* - 1.

[12/02/2017 23:00:27] 1-1.1-1.1-1.1-1 - 1.

[12/02/2017 23:00:27] ana oltlo gam3 al 11.5m ra7 2ly gm3thom b3ad keda oltlo gam3 12m 2ly gm3thom fa olto gam3 12.5 - 1.

[12/02/2017 23:00:27] 255.256.255.255 - 0.

[12/02/2017 23:00:27] 0052.255.255.1231 - 0.
https://github.com/karimcambridge/sa...daf6b0b4d624cd
found a new bug or idk
why does it counts this text 'Let's goto ******** and chat there...' as an ADV it kicks me multiple times with false reasons .... and iam not using any another Includes for ADV detect... please some bug fixs
Reply
#18

Код:
public OnPlayerText(playerid, text[])
{
	if (stringContainsIP(text, false, true))
	{
default.pwn(1927) : error 047: array sizes do not match, or destination array is too small


Also links in your Github Repository must be updated.
Reply
#19

Код:
I sell 2. mp5 for 6.000$, 3uzi for 4.000$, 4mp5 for 200$
Detect an IP. I set fixedSeparation to true, IP become easily undetectable like
Код:
127.0.0 .1
Reply
#20

The include don't work, bro!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)