1. NOP

    NOP Naked Wanderer

    There are common methods that I include in most of my plugins, for example :

    Code (Text):
    bool IsAdmin(BasePlayer player)
            {
                return player.net?.connection?.authLevel >= 1;
            }

    void Message(BasePlayer player, string theMessage)
            {
                PrintToChat(player, theMessage);
                Puts("Player [" + player.displayName + "] received message : " + theMessage);
            }
    etc.

    Where is the best place / best practices in Oxide to put stuff like this, so these methods can be called by all my other plugins?

    Thanks in advance! :]
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Rust already has an IsAdmin() helper, so there isn't really a need for the >= 1 check unless you want to have moderators showing as admin.

    Otherwise, you could make an Ext.FileName.cs under the oxide/plugins/includes folder and then reference that with your plugin.

    The most common practice for public plugins is to use them in each plugin though, but for private plugins using the above method would be better most likely to avoid duplication.
     
  3. NOP

    NOP Naked Wanderer

    Perfecto! Thanks.

    I use the FauxAdmin plugin, and give everyone on my server FauxAdmin, so they can use real NoClip, and God Mode. That's why I replace all player.IsAdmin() calls with IsAdmin(player) :p