SA-MP Forums Archive
OnPlayerText problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerText problem (/showthread.php?tid=358459)



OnPlayerText problem - Squirrel - 10.07.2012

Well I added anti swear sys and now chat aint working at all...


PHP код:
public OnPlayerText(playerid, text[])
{
    static 
LastText[MAX_PLAYERS][128];
    if(
strfind(LastText[playerid], text, false) != -1) return SendClientMessage(playerid, COLOR_RED, "<!>Don't spam!"), 0;
    
strmid(LastText[playerid], text, 0, strlen(text), sizeof(LastText[]));
    new
        
badWords[][] =
        {
            
"bitch",
            
"ass",
            
"fuck",
            
"nigger",
            
"nigga",
            
"jew",
            
"retard",
            
"whore",
            
"hoe",
            
"negro",
            
"chongo",
            
"nazzi",
            
"noob",
            
"motherfucker",
            
"pussy",
            
"puto"
        
}
    ;
    for(new 
i; i != sizeof(badWords); ++i)
    {
        
replaceSwear(text, badWords[i]);
    }
    return 
0;
}
stock replaceSwear(string[], badWord[], replace = '*')
{
    new
        
i
    
;
    while((
i = strfind(string, badWord, true)) != -1)
    {
        for(new 
x = (i + strlen(badWord)); i != x; ++i)
        {
            
string[i] = replace;
        }
    }
    return 
1;
} 
Commands are working fine but each time I try to use chat it just doesnt display the message


Re: OnPlayerText problem - tyler12 - 10.07.2012

try returing 1?


Re: OnPlayerText problem - Squirrel - 10.07.2012

Resolved, there was problem with something else. Thanks anyway