Hello guys my first day, my first topic and my first release for you all.
Note: This is for you to learn no matter if you only copy/paste butmake sure to learn from it, will help you alot in future scripting.
What does it do?
♦ This script will filter out all offensive words in the text a player types, if it finds any it will warn the player 5 times and after that kick
How many languages are there to choose from?
♦ English, Use the same method to add other languages.
♦
Warning: Use 1 Language at a time for example if you want to use spanish instead of english copy baste the english words code and add the spanish offensive words after that comment the english code and don, if you want to use english then un-comment and comment spanish not that much hard
Featured languages:
add much languages you want but 1 at a time
Why can you only pick 1 language at a time?
♦ This has 2 reasons, the first one is to reduce lagg since the script must loop through all possible words, if you would put in all the languages it had to loop through 1000+ words for every line of text a player types, typically this would induce lagg. The second reason is because some words in one language are not offensive in another, putting in all languages would cause the script to censor waaay to much words initially not ment to be offensive.
time for coding.
Top of Script:
#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
// 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"},
{"*****"},
{"niglet"},
{"nutsack"},
{"paki"},
{"panooch"},
{"pecker"},
{"peckerhead"},
{"penis"},
{"piss"},
{"polesmoker"},
{"pollock"},
{"poonani"},
{"porchmonkey"},
{"prick"},
{"punanny"},
{"punta"},
{"pussies"},
{"pussy"},
{"pussylicking"},
{"puto"},
{"queef"},
{"renob"},
{"rimjob"},
{"ruski"},
{"sand******"},
{"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"}
};
new swearCount[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason){
swearCount[playerid] = 0;
}
paste it like that with onplayerdissconnect
public OnPlayerText(playerid, cmdtext[])
{
if((strlen(cmdtext) < 3) || (cmdtext[0] == '/') || (cmdtext[0] == '#') || (cmdtext[0] == '!')) return 1;
new offset;
new len;
for(new i=0; i<MAX_WORDS; i++)
{
offset = strfind(cmdtext, swear[i], true);
if(offset > -1)
{
len = strlen(swear[i]);
if(len < 3) break;
for(new y=0; y<len; y++)
{
cmdtext[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;
}
the onplayeretext sure you can just copy the main thing lol not the whole onplayertext because it will make problem with ur commands
Feel free to post any bugs you find
Credits
• Sinner
• Wikipedia for a considerable part of the words