1. moderates shops from using malicious words and broadcasting them.

    I have a list of words that I don't want to be seen on my server, however I seem to have run into a problem with the Event Handlers on Rust. All of the Vending Machine hooks are pre-usage, none of them are post-usage.

    Is there a way to catch when a player leaves the vending machine dialog, updates a name, or updates anything on a vending machine?
     
  2. Wulf

    Wulf Community Admin

    Have you looked at the UFilter plugin? It does what you're looking for. The BetterChatFilter would as well.
     
  3. I'm looking at them now, and it doesn't seem to filter vending machines in their descriptions.

    UFilter: "UFilter automatically blocks advertising of IP addresses or domain names that aren't allowed and blocks profanity if enabled in names and messages."

    And I'd assume BetterChatFilter is only for chat.

    You are the developer of UFilter, perhaps I'm incorrect.

    I'm also not trying to ban the name from chat. It's hard to say without spilling my ideas (I want to remain secretive until I reveal my server idea), but I don't want people to put a specific word in a vending machine and broadcast it.
     
  4. Wulf

    Wulf Community Admin

    Ah, missed that you wanted it for vending machines, thought you were referring to chat AND vending. :p

    As far as vending machines go, I'm unsure about that, but the available hooks can be found in the Docs link at the top. I don't recall there being any hooks when names are set and such, so you may have to hook after something is updated.
     
  5. Thank you for your help. Have an awesome day. :)
     
  6. Maybe there's a way to periodically check each vending machine on the map?


    Code:
                   List<string> bad_words = new List<string>();                foreach(var mach in GameObject.FindObjectsOfType<SimpleBuildingBlock>())
                    {
                        var name = mach?.name ?? string.Empty;
                        if (!name.ToLower().Contains("vending")) continue;                    VendingMachine v = (VendingMachine)mach.GetEntity();                    if (bad_words.Contains(v.GetPanelName())){
                            v.globalBroadcast = false;
                            BasePlayer owner = BasePlayer.FindByID(v.OwnerID);                        if (BasePlayer.activePlayerList.Contains(owner))
                            {
                                owner.SendMessage("Hey! that's a bad word!");
                            }
                        }
                    }
    
    This is what I have so far.
     
    Last edited by a moderator: Apr 13, 2018