strfind but then the amount of find.
#1

Hi there, is there a way to find out how many times something is found?

like

pawn Код:
new ipfind = strfind(params, ".", true);
            new portfind = strfind(params, ":", true);
            if(ipfind != -1 && portfind != -1)
            {
                if(PlayerInfo[playerid][AdminLevel] < 3)
                {
                    new string43[128];
                    format(string43, sizeof(string43), "%s just got kicked for Advertising by **AntiCheat V2.0**", SenderName);
                    ProxDetector(10000000000.0, playerid, string43, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF);
                    SendClientMessage(playerid, COLOR_RED, "Advertising is not allowed!");
                    Kick(playerid);
                }
And it only kicks if "." is found like 3 times?
Reply
#2

Regular expression is way better than strfind method. See this post.
Reply
#3

Like what? I dont understand
Reply
#4

So I tried to understand this code:

pawn Код:
stock ContainsIPEx(const string[])
{
    static
        RegEx:rCIP
    ;

    if ( !rCIP )
    {
        rCIP = regex_build("(.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?)");
    }

    return regex_match_exid(string, rCIP);
}
by Fro1sha


But how do I actually use it?
Reply
#5

Place that function somewhere in your script and use it like this:
pawn Код:
if(ContainsIPEx(params))
{
    //ban
}
Reply
#6

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)