1. Alright. It seems like this is a question that many people ask but I've not seen a single answer yet that can help me. That's why I really would appreciate if someone could tell me in details on how to create a plugin in C#. I've got the basics of C# and everything but I can't find any guides on how to start developing Oxide Plugins.

    Thanks.
    • Where do I start?
    • What DLLs are needed?
    • Etc..
     
  2. Hello,

    Where to start => Look at the docs and plugins.
    What dll => all from RustDedicated_Data\Managed
    etc => got some ideas and look at same plugins.
     
  3. Okay.. What I've done.

    1. Taken all DLLs from RustDedicated_Data\Managed except the ones inside RustDedicated_Data\Managed\x86 and x64. (68 DLLs in total)
    2. Started a C# Project and added all DLLs as references by using the browse button.
    3. I then get a error and all DLLs are not imported. (Counted them in references, to the right inside Visual Studio)

    The Error:

    Code:
    A reference to 'C:\Users\Jonathan\Desktop\Rust DLLS\mscorlib.dll' could not be added. This component is already automatically referenced by the build system.
     
  4. You have to deselect system and mscorlib if i remember
     
  5. Alright. That worked.. Thanks!

    • I now have all the references that I need.
    • What does Puts("Hello.") do? (My understaning is that this will print something to the console?)
    • What do I do now? (I've tested around and got this but it does not seem to be working.)
    Code:
    namespace Oxide.Plugins
    {
        [Info("Test", "Jompe", 1.0)]    public class Class1 : RustPlugin
        {
            void Loaded()
            {
                Puts("Testing..");
            }
        }
    }
     
  6. well, your base code should look like
    Code:
    namespace Oxide.Plugins
    {
        [Info("PTest", "sami37", "1.0.0")]
        [Description("New plugin")]
        class PTest : RustPlugin
        {
            void Loaded()
            {
                 Puts("Loaded");
            }
        }
    }
    and should be saved as PTest.cs
     
  7. Alright.. I got it working..

    Thanks, really appreciate it!

    What I did:

    • Change RustPlugin to CovalencePlugin. (What's the difference?)
    • Added using Oxide.Core.Libraries.Covalence; as a part of CovalencePlugin.
    • Found out that Puts() prints something to the console.
    Code:
    using Oxide.Core.Libraries.Covalence;namespace Oxide.Plugins
    {
        [Info("TestPlugin", "Jompe", 1.0)]    public class MyPlugin : CovalencePlugin
        {
            [Command("test")]
            void TestCommand(IPlayer player, string command, string[] args)
            {
                player.Reply("Test Successful!");
                Puts("Testing Puts..");
            }
        }
    }
     
  8. Wulf

    Wulf Community Admin

    A Covalence plugin is meant to be universal between all games we support, a RustPlugin is Rust only. There will be different methods and helpers available between those versions.
     
  9. Alright.. Do you know why it wont load with RustPlugin?
     
  10. Wulf

    Wulf Community Admin

    It'll likely show you why in the console or logs.
     
  11. Nope.. The command /test that I added wont work.. It says that it loads but nothing works.
     
  12. Wulf

    Wulf Community Admin

    If you used [Command], that's for Covalence only. [ChatCommand] and [ConsoleCommand] are for RustPlugin.
     
  13. Ah.. That explains it. Thanks!
     
  14. I've gotten into it more and more now but my new question is now how to get the group that the player currently is in.
     
  15. Wulf

    Wulf Community Admin

  16. I don't really understand how I can use this..

    I tried to copy from Github but GetUserData get's marked red..
    Code:
                [LibraryFunction("GetUserGroups")]
                public string[] GetUserGroups(string id) => GetUserData(id).Groups.ToArray();
     
  17. Wulf

    Wulf Community Admin

    permission.GetUserGroups(steamid);