|
Veteran Member
Join Date: Jun 2014
Location: Karachi, Pakistan
|
08-06-2019
, 01:41
Re: Block IP Pattern (With Spaces)
|
#16
|
Quote:
Originally Posted by bad_boy
Can you please give mines a try, it should block the spaces.
I'm sure the plugin can be improved so test it and give me some feedback.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>
new const BlockIps[ ] = "\b(?:\d{1,3}\s)\d{1,3}\b"
new ret,error[ 2 ]
new Regex:Spam
public plugin_init()
{
register_plugin( "Block IP", "1.0", "Allied")
register_clcmd( "say", "spamming" )
register_clcmd( "say_team", "spamming" )
Spam = regex_compile ( BlockIps, ret, error, charsmax ( error ) )
}
public spamming( id )
{
new text[ 128 ], ret
read_args( text, charsmax( text ) )
new Check = regex_match_c( text, Spam, ret )
if( Check > 0 )
{
client_print( id, print_chat, "Stop Advertising !!" )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
|
Will give it a try, when at home.
Till yet as said by you, may be someone improve it too?
|
|
|
|