Anti Ad in /pm
#1

Hello,
I'v pm system, but some players abuse it, such as send to other people IP's , can i make anti Ad, which return 0; or kick player?, this is the cmd:

Код:
CMD:pm(playerid, params[])
{
    if(time2[playerid] > gettime()) return GameTextForPlayer(playerid,"~b~Please Wait 5 Seconds!",2000,3);
    new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us", id, str2))
    {
        GameTextForPlayer(playerid,"~Y~/pm ~R~<id> <message>~N~~Y~/pms ~W~to ~G~enable ~W~/~R~disable ~W~the messages",5000,3);
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
    if(GetPVarInt(id, "PMEnabled") == 0) return GameTextForPlayer(playerid, "~n~~n~~r~Player Disabled PM", 3000, 5);
    if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
    {
        GetPlayerName(playerid, Name1, sizeof(Name1));
        GetPlayerName(id, Name2, sizeof(Name2));
        format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
        SendClientMessage(playerid, Yellow, str);
        GameTextForPlayer(id,"~N~~N~~N~~N~~N~~N~~N~~b~You got a new message!",3000,3);
        format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
        SendClientMessage(id, Green, str);
        time2[playerid] = gettime() +5;
    }
    return 1;
}
Reply
#2

Just use something like this:
pawn Код:
if(strfind(word,"http://",true)!=-1 || strfind(word,"prpg",true)!=-1 || strfind(word,".com",true)!=-1 || strfind(word,".net",true)!=-1 || strfind(word,"91.",true)!=-1 || strfind(word,"195.",true)!=-1 || strfind(word,".org",true)!=-1 || strfind(word,"n4g",true)!=-1 || strfind(word,"prpg",true)!=-1 || strfind(word,"-rp",true)!=-1)
    {
        return kick/ban/whatever, 0;
    }
Obvoiusly change the strings to keywords that you want to catch out. Put it as a condition before sending anything out.
Reply
#3

but there are many websites such as .ae .. is there are another way?
Reply
#4

ok how do you detect advertisement in the main chat? (OnPlayerText)
or are you asking us to create an anti-ad system?
Reply
#5

Ads are very hard to detect. If they are IPs or websites you can check them with regex (search it on the forums, regex can also filter things like "blah . com").
But there is ALWAYS a way to avoid the filter, like "blah dot com" or whatever, you just have to be creative.

To block websites, there are lists of all (or all common) top-level-domains (= ".de", ".com" etc.), so you don't have to make a list yourself.

But honestly, I'd rather let some ads be there than every 3rd chat message being blocked because of a too sensitive filter.
Reply
#6

i have that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)