Onplayertext advertise ban
#1

well i need help with an anti advertise, i have one that bans people who types certain ips like 80.172.224.244:6666

but if somebody types 80 172 224 244 6666 they will just keep spamming and people just leaves the server,

can somebody helps me?
Reply
#2

In OnPlayerText add:

pawn Код:
new ads;

    for(new a, l = strlen(text); a < l; a++)
    {
    if (text[a] == ':' && d == 3) return ads++;
    if(ads == 3) return SendClientMessage(playerid,COLOR_RED,"Not Advertising!");
    if (text[a] == '.' && d < 3) d++;
    if(ads == 3) return Ban(playerid);
    }
    return 1;
}
Attention: Not Tested!
Reply
#3

Quote:
Originally Posted by ► © The LuxurioN™
In OnPlayerText add:

pawn Код:
new ads;

    for(new a, l = strlen(text); a < l; a++)
    {
    if (text[a] == ':' && d == 3) return ads++;
    if(ads == 3) return SendClientMessage(playerid,COLOR_RED,"Not Advertising!");
    if (text[a] == '.' && d < 3) d++;
    if(ads == 3) return Ban(playerid);
    }
    return 1;
}
Attention: Not Tested!
thanks, it didn't work, it also made a little warning, undefined simbol "d"
i've put new d;

but didn't work,
Reply
#4

pawn Код:
new d;
    new ads;
    for(new a, l = strlen(text); a < l; a++)
    {
    if (text[a] == ':' && d == 3) return ads++;
    if(ads == 3) return Ban(playerid);
    if (text[a] == '.' && d < 3) d++;
    if(d == 3) return Ban(playerid);
    }
    return 1;
}
Not tested!
Reply
#5

Quote:
Originally Posted by ► © The LuxurioN™
pawn Код:
new d;
    new ads;
    for(new a, l = strlen(text); a < l; a++)
    {
    if (text[a] == ':' && d == 3) return ads++;
    if(ads == 3) return Ban(playerid);
    if (text[a] == '.' && d < 3) d++;
    if(d == 3) return Ban(playerid);
    }
    return 1;
}
Not tested!
just a question will this ban people that use ips like this 80 172 224 244 6666 :S
Reply
#6

sorry the damn double post... but this doesn't work
Reply
#7

those damn gays
but just they keep on coming, like "hey this server sucks, join 192.... " i ban them and they just keep changing their ip ...

Seif_ do you know then a way to block ip advertisement with pontuation, by pm? i only have cmd and OnPlayertext blocked :\
Reply
#8

Try to put this on every command
Код:
if(FindIP(text))
    {
        new advertiser[MAX_PLAYER_NAME];
		GetPlayerName(playerid, advertiser, sizeof(advertiser));
		format(string, sizeof(string), "AdmCmd: %s was warned & kicked by AdmBOT, reason: Server Advertising",advertiser);
		SendClientMessageToAll(COLOR_LIGHTRED,string);
		KickLog(string);
        PlayerInfo[playerid][pWarns] += 1;
        Kick(playerid);
        return 1;
    }
and this as an public
Код:
FindIP(StrToChk[])
{
	new IpLevel = 0;
	for(new a = 0; a < strlen(StrToChk); a++)
	{
		switch(IpLevel)
		{
			case 0:
			{
	    		if(IsNum(StrToChk[a])) IpLevel++;
			}
			case 1, 2:
			{
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 4;
                else IpLevel = 0;
			}
			case 3:
			{
			    if(StrToChk[a] == '.') IpLevel++;
			    else IpLevel = 0;
			}
			case 4:
			{
			    if(IsNum(StrToChk[a])) IpLevel++;
			    else IpLevel = 0;
			}
			case 5, 6:
			{
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 8;
                else IpLevel = 0;
			}
			case 7:
			{
			    if(StrToChk[a] == '.') IpLevel++;
			    else IpLevel = 0;
			}
			case 8:
			{
			    if(IsNum(StrToChk[a])) IpLevel++;
			    else IpLevel = 0;
			}
			case 9, 10:{
                if(IsNum(StrToChk[a])) IpLevel++;
                else if(StrToChk[a] == '.') IpLevel = 12;
                else IpLevel = 0;
			}
			case 11:
			{
			    if(StrToChk[a] == '.') IpLevel++;
			    else IpLevel = 0;
			}
			case 12:
			{
			    if(IsNum(StrToChk[a])) return 1;
                else IpLevel = 0;
   			}
  		}
	}
	return 0;
}
Reply
#9

Quote:
Originally Posted by heber
Посмотреть сообщение
In OnPlayerText add:

pawn Код:
new ads;

    for(new a, l = strlen(text); a < l; a++)
    {
    if (text[a] == ':' && d == 3) return ads++;
    if(ads == 3) return SendClientMessage(playerid,COLOR_RED,"Not Advertising!");
    if (text[a] == '.' && d < 3) d++;
    if(ads == 3) return Ban(playerid);
    }
    return 1;
}
Attention: Not Tested!
This shit doesn't works...
Reply
#10

Junkbuster has one.

Check the script and stop calling the scripts shit, people try to make it for you and you cant do any better.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)