block swearwords
#1

how would i make it so if you say **CK in the chatbox it just sends you a msg saying "no swearing"

thanks

and i dnt wanna use filterscripts
Reply
#2

i belive its something like
pawn Код:
public OnPlayerText(playerid, text[]){
    if(!strcmp(bitch, text, true, 8) || !strcmp(asshole, text, true, 8) || !strcmp( text, true, 6)!strcmp(cunt, text, true, 8)){
        SendClientMessage(playerid,colour,"no swearing");
        return 0;
    }
    return 1;
}
Reply
#3

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
i belive its something like
pawn Код:
public OnPlayerText(playerid, text[]){
    if(!strcmp(bitch, text, true, 8) || !strcmp(asshole, text, true, 8) || !strcmp( text, true, 6)!strcmp(cunt, text, true, 8)){
        SendClientMessage(playerid,colour,"no swearing");
        return 0;
    }
    return 1;
}
Strings should be wrapped into "" tags. "bitch"

I would rather make an array and loop through the array.

pawn Код:
new SwearWords[] = {
    "Fuck",
    "Bitch"
};

public OnPlayerText(playerid, text[])
{
    for(new i; i < sizeof(SwearWords); i++)
    {
        if(strfind(text, SwearWords[i], true) != -1) // IF you want SwearWords not to be case sensitiv change ' true ' to ' false '
        {
            SendClientMessage(playerid, COLOR_RED, "Please don't swear.");
            return 0;
        }
    }
    return 1;
}
Reply
#4

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)