OnPlayerText problems, oh joy..
#2

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(playeridreason){
    
swearCount[playerid] = 0;
}
public 
OnPlayerText(playeridtext[])
{
    if((
strlen(text) < 3) || (text[0] == '/') || (text[0] == '#') || (text[0] == '!')) return 1;
    new 
offset;
    new 
len;
     for(new 
i=0i<MAX_WORDSi++)
    {
        
offset strfind(textswear[i], true);
        if(
offset > -1)
        {
            
len strlen(swear[i]);
            if(
len 3) break;
            for(new 
y=0y<leny++)
            {
                
text[offset+y] = '*';
            }
            
swearCount[playerid]++;
            new 
string[64];
            
format(stringsizeof(string), "Swearing is not allowed here, warning %d/%d"swearCount[playerid], MAX_SWEARCOUNT);
            
SendClientMessage(playerid0xE60000FFstring);
               if(
swearCount[playerid] >= MAX_SWEARCOUNT)
            {
                new 
name[24];
                
GetPlayerName(playeridnamesizeof(name));
                
format(stringsizeof(string), "*** %s has been kicked for offensive language"name);
                
SendClientMessageToAll(0xE60000FFstring);
                
Kick(playerid);
                break;
            }
            break;
        }
    }
    return 
1;

I took this from my released script, hope it helps.

EDIT: I think you're problem is that you're doing ( != -1) when it should be ( > 1) in strfind()
Reply


Messages In This Thread
OnPlayerText problems, oh joy.. - by Skylar Paul - 13.04.2011, 17:24
Re: OnPlayerText problems, oh joy.. - by Sinner - 13.04.2011, 17:33

Forum Jump:


Users browsing this thread: 2 Guest(s)