SA-MP Forums Archive
Censored Words - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Censored Words (/showthread.php?tid=121191)



Censored Words - yopuya - 15.01.2010

How can I do that when a player uses censored words receive mute for 3 minutes and if it continues to take 3 time player kicked


Re: Censored Words - Doppeyy - 15.01.2010

You have to check what a player types in:
OnPlayerText
Use the search button to search for it.

Reaver~


Re: Censored Words - Kyeno - 15.01.2010

Sounds like a bit bigger script so i hope You're experienced with coding.

My suggestion would be like,

First, make some censored words array of strings, some gPlayerMuted[MAX_PLAYERS] array of bools, and gPlayerEverWasMuted[MAX_PLAYERS] array of bools

Then in OnPlayerText() game callback check, if the user input text (or its fragment) matches any of the censored words.
If so - check if he was ever muted. If yes - kick. If not - send user warning, and set it's muted + everwasmuted state to true. Also set some mute timer to de-mute the player after certain period of time.

Ofcourse OnPlayerText() would have to return false/private client warn message when user tries to type and he's muted.

That would be my approach


Re: Censored Words - Miguel - 16.01.2010

Top:
pawn Код:
forward UnMuteEm(playerid);
pawn Код:
new muted[MAX_PLAYERS]; // muted variable
new mutedcount[MAX_PLAYERS]; // how many mutes variables
new chatcount[MAX_PLAYERS]; // how many times chat bad words
OnPlayerText:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(muted[playerid] == 1) return 0; // he cannot talk if hes muted
    else if(strfind(text, "eyehole", true) > -1) // here we check if he's saying a bad word, "eyehole" should be remplaced
    {
        if(chatcount[playerid] > 1) // if he has 2 or more he's gonna be muted
        {
            if(mutecount[playerid] > 2) // if he has been muted more than twice he's going to be kicked
            {
                SendClientMessage(playerid, COLOR, "You have been kicked out for saying bad words!");
                Kick(playerid);
            }
            else // if he has not, then:
            {
                SendClientMessage(playerid, COLOR, "You have been muted because saying bad words!");
                chatcount[playerid] = 0;
                muted[playerid] = 1;
                SetTimerEx("UnMuteEm", 180 * 1000, false, "d", playerid);
                mutecount[playerid] ++;
            }
        }
        else // if he doesn't even have morae that one chat count then add 1 more
        {
            SendClientMessage(playerid, COLOR, "Don't say bad words!");
            chatcount[playerid] ++;
            return 0; // return 0 means the text is not gonna be showed
        }
    }
    return 1;
}

Anywhere:

pawn Код:
public UnMuteEm(playerid) // to unmute him
{
    muted[playerid] = 0;
    SendClientMessage(playerid, COLOR, "You have been unumuted!");
    return 1;
}
I hope that's what you wanted :P.


Re: Censored Words - [HiC]TheKiller - 16.01.2010

pawn Код:
new Badwords[][] =
{
    "Fuck",
    "Shit",
    "Nigger",
    "Crap"
}; //Just add more using , and quote them.
new Muted[MAX_PLAYERS];

public OnPlayerText(playerid, text[])
{
    for(new Z; Z<sizeof(Badwords); Z++)
    {
      if(strfind(text, Badwords[Z], true))
      {
        Muted[playerid] ++;
        SetTimerEx("Unmute", 180000, false, "d", playerid);
        SendClientMessage(playerid, COLOR, "You have been muted for 3 minutes for saying bad words!");
            return 0;
        }
    }
    if(Muted[playerid] == 1)
    {
      SendClientMessage(playerid, COLOR, "You are muted");
      return 0;
    }
    return 1;
}

forward Unmute(playerid);
public Unmute(playerid)
{
  Muted[playerid] --;
  SendClientMessage(playerid, COLOR, "You have been unmuted, DON'T REPEAT IT!");
    return 1;
}



Re: Censored Words - yopuya - 16.01.2010

wow
thx all