Thread: [Solved] code Problem
View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-01-2021 , 11:43   Re: code Problem
Reply With Quote #4

Try this
Code:
public ChatGlobalCommand(id) {     static lastsaid[512], said[512] , iPos;     read_args(said, 512)         if(equal(said, lastsaid))         return PLUGIN_CONTINUE         for ( new i = 0 ; i < sizeof BAD_WORDS ; i++ )     {
        //The return value of containi() cannot be used as a bool since it returns -1 (true) if nothing is found. Always use != -1, > -1, or >= 0
        if ( ( iPos = containi( said , BAD_WORDS[i] ) ) > -1 )
        {
            //Replaced replace_all() with setc() to fill in bad word chars with *
            setc( said[ iPos ] , strlen( BAD_WORDS[ i ] ) , '*' );             //replace_all( said , charsmax( said ) , BAD_WORDS[i] , "***")         }     }         formatex(lastsaid, charsmax(lastsaid), "%s", said)     client_cmd(id, "say %s", said)         return PLUGIN_HANDLED }
__________________
Bugsy is offline