strfind won't work
#4

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!");
}
Reply


Messages In This Thread
strfind won't work - by Extasy4 - 13.08.2013, 16:57
Re: strfind won't work - by Misiur - 13.08.2013, 17:00
Re: strfind won't work - by Extasy4 - 13.08.2013, 17:14
Re: strfind won't work - by Misiur - 13.08.2013, 17:23
Re: strfind won't work - by Extasy4 - 13.08.2013, 17:29
Re: strfind won't work - by Extasy4 - 13.08.2013, 17:34
Re: strfind won't work - by Misiur - 15.08.2013, 12:06
Re: strfind won't work - by Extasy4 - 15.08.2013, 13:21
Re: strfind won't work - by Extasy4 - 17.08.2013, 21:31
Re: strfind won't work - by cessil - 17.08.2013, 22:08

Forum Jump:


Users browsing this thread: 1 Guest(s)