1. Bear with me, I know I'm doing something exceptionally wrong. So I'm trying to alter the NoGiveNotices plugin, I use this to avoid that one guy screaming "ADMIN ABUSE!!!11!11!" when I spawn in 5k wood to build a community structure, but I'd also like to output into a log file what the player spawned in, as my moderators have access to this and I'd like to be able to check a log file and occasionally make sure they're not abusing it.

    I have experience in programming, but not C# or Oxide at all, so I've got two methods here, the original and mine that logs it to a file. Problem is it's polluting the namespace and the one to log it doesn't seem to run. Is there any way I could combine these two and still get the desired results?

    Code:
    // Block Message
    class NoGiveNotices : RustPlugin
    {
        object OnServerMessage(string m, string n) => m.Contains("gave") && n == "SERVER" ? (object)true : null;
    }
        
        
    // Log
    class LogGiveNotices : RustPlugin
    {
         object OnServerMessage(string m, string n) {
            if (m.Contains("gave") && n == "SERVER") {
                LogToFile("gives", $"[{System.DateTime.Now}]" + m, this);
            }
            return null;
        }
    }
     
  2. Wulf

    Wulf Community Admin

    There's no need to have multiple classes like that, just combine it under a single class using the existing hook.
    Code:
    class NoGiveNotices : RustPlugin
    {
         object OnServerMessage(string message, string name)
        {
            if (message.Contains("gave") && name == "SERVER")
            {
                LogToFile("gives", $"[{System.DateTime.Now}]" + message, this);
                return true;
            }        return null;
        }
    }
     
  3. It works! Thanks so much!