SA-MP Forums Archive
block swearwords - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: block swearwords (/showthread.php?tid=230297)



block swearwords - Lethaal - 23.02.2011

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


Re: block swearwords - (SF)Noobanatior - 23.02.2011

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;
}



Re: block swearwords - Cameltoe - 23.02.2011

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;
}



Re: block swearwords - Lethaal - 23.02.2011

thanks