Solved Auto mute people

Discussion in 'Plugin Requests' started by Frank Costello, Jul 24, 2016.

  1. Is there a possibility to mute players, if they not use latin letters?

    I had once enabled 'Anti bad language' in RustAdmin, to kick all players who type Cyrillic letters, but thats not working with Better Chat, or in general.

    Or

    Auto mute players on join, if they from a specific country.

    Thanks!
     
  2. Anyone? I can pay for it.
     
  3. Wulf

    Wulf Community Admin

    There should be some plugins that already provided chat filtering such as BetterChat, Chat Handler, etc.
     
  4. Yeah, i know the BetterChat feature 'Word Filter', but isn't it only for single words? I need something that blocks Cyrillic letters/words in general.

    Thanks :p
     
  5. well something like that in betterchat should work
    Code:
                if(Regex.IsMatch(stringToCheck,@"\p{IsCyrillic}"))
                {
                    SendChatMessage(player, "You can't used that language, please use international language.");
                    return false;
                }
    
    Just add this code part to betterchat plugin in
    object OnUserChat(IPlayer player, string message)
    like that

    Code:
            object OnUserChat(IPlayer player, string message)
            {
                Player pl = Player.FindOrCreate(player);            if (pl == null)
                    PrintWarning("PLAYER IS NULL!");            if (GetConfig(false, "Word Filter", "Enabled"))
                    message = FilterText(message);            //  Is message invalid?
                if (message == string.Empty || message.Length < General_MinimalChars)
                    return false;            pl.mute.Update();            // Is global mute active?
                if (globalMute)
                {
                    SendChatMessage(player, GetMsg("Global Mute", player.Id));
                    return false;
                }            //  Is player muted?
                if (pl.mute.Muted)
                {
                    if (pl.mute.state == MutedState.TimeMuted)
                    {
                        TimeSpan remainingTime = pl.mute.date.value - DateTime.Now;
                        SendChatMessage(player, GetMsg("You Are Time Muted", player.Id).Replace("{time}", FormatTime(remainingTime)));
                    }
                    else
                        SendChatMessage(player, GetMsg("You Are Muted", player.Id));
                    return false;
                }
                if(Regex.IsMatch(stringToCheck,@"\p{IsCyrillic}"))
                {
                    SendChatMessage(player, "You can't used that language, please use international language.");
                    return false;
                }
    
    Feel free to donate if i helped :)
     
    Last edited by a moderator: Jul 25, 2016
  6. Gonna try it out soon, gonna donate for sure if its working. Thanks in advance! :D


    EDIT: Just tested it. The name `stringToCheck' does not exist in the current context
     
    Last edited by a moderator: Jul 26, 2016
  7. Wulf

    Wulf Community Admin

    "stringToCheck" was just a placeholder, you'd need to replace it with the message variable in the example that was given.
     
  8. Oh yeah sorry I miss to change it back to message
     
  9. Damn, never thought it would be so easy, i remember putting \p{Cyrillic} in RustAdmin and it worked for normal chat. Anyways.. thanks for helping me sami37 and Wulf!

    You can mark this as solved
     
  10. You set it as solved using the thread tools.