Raised This Month: $ Target: $400
 0% 

conaini counts


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-23-2011 , 15:40   Re: conaini counts
Reply With Quote #1

Instead of doing an "ignore" list, you should properly check for bad words that aren't inside of other words.

Here's some example code, which you'll have to translate to your own variables and such.

Code:
checkSaid(said[]) {     new pos, len;     for(new i = 0; i < sizeof(g_badWords); i++)     {         pos = containi(said, g_badWords[i]);                 // bad word found         if(pos >= 0)         {             // if there is nothing before it so it's the start of the word             if(pos == 0 || !isalpha(said[pos - 1]))             {                 // if there is nothing after it, so then the bad word is singled out                 if(!isalpha(said[pos + strlen(g_badWords[i])]))                 {                     // bad word found                     return 1;                 }             }         }     }         // no bad words found     return 0; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Schwabba
Senior Member
Join Date: Apr 2008
Old 06-24-2011 , 06:43   Re: conaini counts
Reply With Quote #2

That's not better, because there are badwords like:

Hure (whore)
Hurensohn (son of a whore)
Hurenkind (child of a whore)

etc. hundrets more

Or the people start to insult with "!" behind the badwords or something.



Now i made it like that:

PHP Code:
        new len strlen(message)
        new 
asc 0num 0
        
for (new 0;<= len;i++)
        {
            if (
message[i] == 32)
            {
                
asc++
                
num 0
            
}
            else
            {
                
token[asc][num] = message[i]
                
num++
            }
        }
        new 
b_foundb_ignore
        
for (new 0;<= len;i++)
        {
            if(
token[i][0])
            {
                new 
b_word 0
                
while ( b_word g_swearNum_high )
                {
                    if ( 
containi token[i], badword_high[b_word++] ) != -)
                    {
                        
b_found++
                    }
                }
                
b_word 0
                
while ( b_word g_swearNum_mid )
                {
                    if ( 
containi token[i], badword_mid[b_word++] ) != -)
                    {
                        
b_found++
                    }
                }
                
b_word 0
                
while ( b_word g_swearNum_warn )
                {
                    if ( 
containi token[i], badword_warn[b_word++] ) != -)
                    {
                        
b_found++
                    }
                }
                
b_word 0
                
while ( b_word g_swearNum_ignore )
                {
                    if ( 
containi token[i], badword_ignore[b_word++] ) != -)
                    {
                        
b_ignore++
                    }
                }
                
copy(token[i], 511"0")
            }
        }
        if(
b_found <= b_ignore)
        {
            
badword_found true
        

It's a weird way, but it works better than everything else.

Last edited by Schwabba; 06-24-2011 at 08:42.
Schwabba is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode