13.08.2013, 17:23
I'd suggest something like:
pawn Код:
#define N_CENSORED 2 //number of censored words
#define N_CENSORED_LEN 32 //length of max string
static const Censored[N_CENSORED_LEN][(N_CENSORED_LEN + 1) char] = {
!"Hitler",
!"Pancakes"
};
stock ContainsCensored(const input[]) {
for(new i = 0; i != N_CENSORED; ++i) {
if(strfind(input, Censored[i], true) != -1) return 1;
}
return 0;
}
//...
if(ContainsCensored(inputtext)) {
SendClientMessage(playerid, COLOR_TOMATO, "Error: The text cannot contain swearwords/some characters!");
}