View Single Post
bad_boy
Member
Join Date: Oct 2018
Old 08-10-2019 , 12:59   Re: Block IP Pattern (With Spaces)
Reply With Quote #18

I tested the previous code and it worked. However it will only block 1 space between the numbers.
This one will block up to 4 spaces between the numbers. If they use 5 spaces or more this will not work.


PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <regex>

new const BlockIps[ ] = "\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}\s{1,4}\d{1,3}"

new ret,error]
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 BlockIpsreterrorcharsmax error ) )
}

public 
spammingid 
{
    new 
text128 ], ret
    read_args
textcharsmaxtext ) )

    new 
Check regex_match_ctextSpamret )
        
    if( 
Check 
    {
        
client_printidprint_chat"Stop Advertising !!" )
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE

bad_boy is offline