Detect Advertisement in /pm
#3

You can add it at the /pm part, for an example;
pawn Код:
CMD:pm(playerid, params[])
{
    new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    if(sscanf(params, "us[256]", id, str2))
    {
        SendClientMessage(playerid, 0xFF0000FF, "{FFFFFF}* {00C0FF} /pm [ID] [MESSAGE]");
        return 1;
    }
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "[PM] - Player not connected");
    if(playerid == id) return SendClientMessage(playerid, 0xFF0000FF, "[PM] - You cannot pm yourself!");
    if (dnd { id } ) return SendClientMessage(playerid, COLOR_RED, "[DND] - Target is in DND(Do Not Disturb) mode");
    if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_RED, "[MUTE] - You can't talk while you're muted!");
   
    if(strfind(str2, ":", true) != -1)
    {
        new i_numcount, i_period, i_pos;
        while(str2[i_pos])
        {
            if('0' <= str2[i_pos] <= '9') i_numcount ++;
            else if(str2[i_pos] == '.') i_period ++;
            i_pos++;
        }
        if(i_numcount >= 8 && i_period >= 3)
        {
            new reason[128], str[112];
            new Admin[24] = "Server";
            format(reason,sizeof(reason),"Advertisement %s",str);
            BanPlayer(playerid,reason,Admin);
        }
    }
    else
    {
        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, COLOR_YELLOW, str);
        format(str, sizeof(str), "[PM] From %s(ID %d): %s", Name1, playerid, str2);
        SendClientMessage(id, COLOR_YELLOW, str);
        format(str, sizeof(str), "PM From %s[%d] to %s[%d]: %s", Name1, playerid, Name2, id, str2);
        SendMessageToAdmins(COLOR_GRAY,str);
    }
    printf("* PM -- From %s -- To %s -- MSG: %s", Name1, Name2, str2);
    return 1;
}
* not exactly tested, but it should avoid the message, and should ban the player *
Reply


Messages In This Thread
Detect Advertisement in /pm - by Blackazur - 22.04.2014, 14:58
AW: Detect Advertisement in /pm - by Blackazur - 22.04.2014, 15:26
Re: Detect Advertisement in /pm - by Kyance - 22.04.2014, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)