server advertising ban bugged
#1

when i do some thing like . . . i get banned for advertising but if you post a Real ip u do get banned but still how can i know if some one is actually is advertising and some one isnt here is the part
pawn Код:
stock IsIp(const string[])
{
    new count = 0;
    new pos[50];
    new length = strlen(string);
    for(new n=0; n<length; n++)
    {
        if(string[n] == '.')
        {
            if(count < 50)
            {
                pos[count] = n;
            }
            count++;
        }
    }
    if(count >= 3)
    {
        new res[50];
        for(new n=0; n<count; n++)
        {
            if(n != (count - 1) && n != count)
            {
                if((pos[n+1] - pos[n]) > 4 || (pos[n+1] - pos[n]) == 1)
                {
                    res[n] = 0;
                }
                else
                {
                    res[n] = 1;
                }
            }
        }
        new result = 0;
        for(new n=0; n<count; n++)
        {
            if(res[n] == 1) result++;
        }
        if(result >= 2)
        {
            return 1;
        }
    }
    return 0;
}
i think this is the ip because here is the were he bans
pawn Код:
if(IsIp(text) && PInfo[playerid][AdminLevel] < 5)
    {
        new string[256];
        format(string, sizeof(string), "{FFFFFF}Administrator {FF9900}Johnny{FFFFFF} Thinks  {FF9900}%s(%d){FFFFFF} is server Advertising!!", PlayerName(playerid),playerid);
        SendClientMessageToAll(COLOR_ERROR, string);
        return 0;
    }
if this isnt it just let me know
Reply
#2

this is my anti ip ad
pawn Код:
stock IpAds(string[]) // i dont remember who made this
{
    new
        dotCount
    ;
    for(new i; string[i] != EOS; ++i)
    {
        if(('0' <= string[i] <= '9') || string[i] == '.' || string[i] == ':')
        {
            if((string[i] == '.') && (string[i + 1] != '.') && ('0' <= string[i - 1] <= '9'))
            {
                ++dotCount;
            }
            continue;
        }
    }
    return (dotCount > 2);
}

public OnPlayerText(playerid, text[])
{


   if(IpAds(text))
    {
     BanEx(playerid,"Advertise");
     return 0;
    }
}
i suggest tp use regex
Reply
#3

pawn Код:
stock IsAdvertisement(text[])
{
    new NuCnt,DotCnt;
    for (new i = 0, l = strlen(text); i < l; i++)
    {
      if ('0' <= text[i] <= '9'){
      NuCnt++; continue;}
      if(text[i] == '.' || text[i] == ':' || text[i] == '_')
      if(text[i+1] != '.' && text[i+1] != ':' && text[i+1] != '_')
      DotCnt++;
      if (NuCnt >= 7 && DotCnt >= 3)
      return true;
    }
    return false;
}
OnPlayerText:

pawn Код:
if(IsAdvertisement(text))
{  
return Kick(playerid);
}
Reply
#4

thanks but can you just try to fix mine? i already have a anti cheat for banning :X
Reply
#5

pawn Код:
if(string[n] == '.')
        {
            if(count < 50)
            {
                pos[count] = n;
            }
            count++;
        }
This is the problem, you're only searching for "." in the text.
Reply
#6

So how can i fix it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)