PHP код:
#include <a_samp>
#define MAX_WORD_LEN 18 // Max lenght of a swear word
#define MAX_WORDS 122 // Max amount of swearwords
#define MAX_SWEARCOUNT 5 // Max warnings before kick
new swearCount[MAX_PLAYERS];
// ENGLISH
new swear[][MAX_WORD_LEN] =
{
{"anus"},
{"arsehole"},
{"ass"},
{"bitch"},
{"blowjob"},
{"boner"},
{"bullshit"},
{"clit"},
{"cock"},
{"cum"},
{"cunt"},
{"dick"},
{"dildo"},
{"douche"},
{"fag"},
{"fellatio"},
{"fuck"},
{"fudgepacker"},
{"gay"},
{"damn"},
{"gooch"},
{"handjob"},
{"hard-on"},
{"homo"},
{"homodumbshit"},
{"humping"},
{"jerkoff"},
{"jigaboo"},
{"jizz"},
{"jungle-bunny"},
{"junglebunny"},
{"kooch"},
{"kootch"},
{"kunt"},
{"kyke"},
{"lesbian"},
{"lesbo"},
{"lezzie"},
{"mcfagget"},
{"minge"},
{"mothafucka"},
{"motherfucker"},
{"motherfucking"},
{"muff"},
{"muffdiver"},
{"munging"},
{"negro"},
{"nigga"},
{"niglet"},
{"nutsack"},
{"paki"},
{"panooch"},
{"pecker"},
{"peckerhead"},
{"penis"},
{"piss"},
{"polesmoker"},
{"pollock"},
{"poonani"},
{"porchmonkey"},
{"prick"},
{"punanny"},
{"punta"},
{"pussies"},
{"pussy"},
{"pussylicking"},
{"puto"},
{"queef"},
{"renob"},
{"rimjob"},
{"ruski"},
{"sandnigger"},
{"schlong"},
{"scrote"},
{"shit"},
{"shiz"},
{"shiznit"},
{"skank"},
{"skullfuck"},
{"slut"},
{"slutbag"},
{"smeg"},
{"snatch"},
{"tard"},
{"testicle"},
{"thundercunt"},
{"tit"},
{"twat"},
{"twatwaffle"},
{"unclefucker"},
{"vag"},
{"vagina"},
{"vjayjay"},
{"wank"},
{"whore"},
{"whorebag"},
{"whoreface"},
{"wop"},
{"@gmail"},
{"@live"},
{"@msn"},
{"@hotmail"},
{".de"},
{".cc"},
{"www."},
{".com"},
{".co"},
{".uk"},
{".org"},
{".net"},
{".info"},
{".tk"}
};
PHP код:
public OnPlayerDisconnect(playerid, reason){
swearCount[playerid] = 0;
}
public OnPlayerText(playerid, text[])
{
if((strlen(text) < 3) || (text[0] == '/') || (text[0] == '#') || (text[0] == '!')) return 1;
new offset;
new len;
for(new i=0; i<MAX_WORDS; i++)
{
offset = strfind(text, swear[i], true);
if(offset > -1)
{
len = strlen(swear[i]);
if(len < 3) break;
for(new y=0; y<len; y++)
{
text[offset+y] = '*';
}
swearCount[playerid]++;
new string[64];
format(string, sizeof(string), "Swearing is not allowed here, warning %d/%d", swearCount[playerid], MAX_SWEARCOUNT);
SendClientMessage(playerid, 0xE60000FF, string);
if(swearCount[playerid] >= MAX_SWEARCOUNT)
{
new name[24];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "*** %s has been kicked for offensive language", name);
SendClientMessageToAll(0xE60000FF, string);
Kick(playerid);
break;
}
break;
}
}
return 1;
}
, hope it helps.
EDIT: I think you're problem is that you're doing ( != -1) when it should be ( > 1) in strfind()