1. ThomasTheTankEngine

    ThomasTheTankEngine Naked Wanderer

    Is anyone able to help me with a simplish plugin? I understand Python to a certain degree but am not able to produce a plugin as it would be a new skill. I have tried looking at other plugins but am unsure how to get things started properly.
     
    Last edited: Feb 20, 2017
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    There aren't really any Python plugins (most are C#) and Python isn't really supported anymore. Which are you trying to write them in?
     
  3. ThomasTheTankEngine

    ThomasTheTankEngine Naked Wanderer

    Well I attempted to begin writing one in C# using Notepad ++ but not sure how to use a hook to trigger my event.. Which I am unsure if that is even correct.
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Could you show what you have so far?
     
  5. ThomasTheTankEngine

    ThomasTheTankEngine Naked Wanderer

    It is absolutely terrible haha sorry :D
    Code (C#):
    namespace Oxide.Plugins
    {
        [Info("Transfer Of Player Information", "ThomasGM", 0.1)]
        [Description("Moves Required File")]

        public class Transfer Of Player Information : ReignOfKingsPlugin
        {
            static void Main()
            {
                string fileName = "Container.Inventory.dat";
                string sourcePath = @"C:\Users\Thomas\Desktop\Reign Of Kings Server\Saves\Slot1\Players\[Number]\[Name]";
                string targetPath =  @"C:\Users\Thomas\Desktop\Reign Of Kings Server\Saves";

        }
    }
    }
    Thanks for the assistance though mate. I appreciate it.
    --- Double Post Merged, Feb 22, 2017 ---
    I don't really like asking you to do so much so if you really want you can just link me to an amazing C# guide haha That is if you don't want to help haha :)
     
    Last edited by a moderator: Feb 22, 2017
  6. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    To start with, the class needs to be the name of the file. So if you named the file: TransferPlayers, then it'd be class "TransferPlayers", not "Trans Of Player Information" like you have right now.

    For your plugin to be initialized, you should use void Init() instead of static void Main() like you have now.

    Also, keep in mind that plugins are sandboxed, so if you are trying to move player files, that may not be possible unless the game itself has a method for that as Oxide restricts System.IO usage to prevent malicious actions from public plugins and on shared hosts.
     
  7. ThomasTheTankEngine

    ThomasTheTankEngine Naked Wanderer

    So I have made the adjustments.
    Code (Text):
    namespace Oxide.Plugins
    {
        [Info("Transfer Of Player Information", "Thomas", 0.1)]
        [Description("Switches Player Files Between Servers")]

        public class MovingFiles : ReignOfKingsPlugin
        {
            void Init()
            {
                string fileName = "File.dat";
                string sourcePath = @"C:\Users\Thomas\Desktop\Reign Of Kings Server\Saves\Slot1\Players\(Number)\(Name)";
                string targetPath =  @"C:\Users\Thomas\Desktop\Reign Of Kings Server\Saves";

        }
    }
    }
    I was just wondering though, since it isn't moving the file, is it possible to make a script that edits a file and when it adjusts a number in that (lets say text document) another external program moves the files? I would assume that the external program would have to be ran when the server is starting up.
     
    Last edited by a moderator: Feb 22, 2017
  8. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    As a plugin, you'd only be able to use the API available to it, which Oxide provides the ability to write JSON files.
     
  9. ThomasTheTankEngine

    ThomasTheTankEngine Naked Wanderer

    So the idea is technically possible but by using JSON files?