Anti Swear
#1

hello. I've used RyDeR's function to make antiswear for cmds. It works for text but not for commands :S It should work for commands like this: Player A writes: /adminchat FUCK, and the text will be ****. Doesnt work, it doesnt gets replaced.

pawn Код:
public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if (!iSpawned[playerid])
    {
        return ShowInfoBox(playerid, "~w~Jus dar ~r~negalite ~w~rasyti, pirmiausia prisijunkite!"), 0;
    }
    if (iCommandSpam[playerid] + 1000 > GetTickCount() && iCommandSpam[playerid] > 0)
    {
        return ShowInfoBox(playerid, "~w~Pries naudojant komanda vel, palaukite ~g~sekunde!"), 0;
    }
    iCommandSpam[playerid] = GetTickCount();
    ChangeSwear(cmdtext);
    return true;
}
pawn Код:
stock ChangeSwear(Text[], Symbol = '*')
{
    new iWords = sizeof(BadWords), i;
    for (new BadWord; BadWord != iWords; ++BadWord)
    {
        while ((i = strfind(Text, BadWords[BadWord], true)) != -1)
        {
            for (new x = (i + strlen(BadWords[BadWord])); i != x; ++i)
            {
                Text[i] = Symbol;
            }
        }
    }
    return true;
}
Reply


Messages In This Thread
Anti Swear - by BaubaS - 10.03.2012, 14:57
Re: Anti Swear - by Calgon - 10.03.2012, 15:39
Re: Anti Swear - by BaubaS - 10.03.2012, 22:54

Forum Jump:


Users browsing this thread: 1 Guest(s)