1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. gogolon

    gogolon Naked Wanderer

    Hello!
    I've got 2 plugins. I want to call a command defined in the 1st one from the 2nd one.

    In 1st plugin (Hurtworld):
    Code (Text):
    [ConsoleCommand("wipeobj")]
            void cmdwipe(PlayerSession session, string command, string[] args)
           
    In 2nd plugin (Covalence)
    Code (Text):
    server.RunCommand("wipeobj");
    The error says that server is not defined, so I tried to use this instead:
    Code (Text):
    ConsoleManager.Instance.ExecuteCommand("wipeobj");
    But it says "unknown command: wipeobj".
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    There is no such thing as "server.RunCommand" in Oxide, only "server.Command" and only for Covalence plugins. "server" is only available if you have the correct references and your plugin is of type CovalencePlugin. Alternately, if your plugin is a HurtworldPlugin, then you can use covalence.Server.Command instead.

    If the plugin registering the command is a Covalence plugin, then [ConsoleCommand] is not a valid attribute so the command wouldn't be registered, and the args you are using are also not valid for a Covalence plugin command.
     
  3. gogolon

    gogolon Naked Wanderer

    ok, so how to call a hurtworld plugin command from covalence plugin?
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I've provided examples above and further explanation. If "wipeobj" comes back as an invalid command though, you aren't registering it. It doesn't matter the type of plugin for command calling, the command just has to exist.
     
  5. gogolon

    gogolon Naked Wanderer

    I am, but in the second script, which is Hurtworld Plugin. It works when you call it from the game.
     
  6. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Without seeing your code, it's hard to really help you. I can tell you though that the attribute isn't being used properly though, as console commands do not have a player object attached to them. Any command that expects a player won't be able to be ran by the server itself.
     
  7. gogolon

    gogolon Naked Wanderer

    So, what is the correct attribute?
     
  8. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    Pretty sure we don't have any for HurtworldPlugin right now, only the [Command] for CovalencePlugin. Any game-specific commands would have to be manually registered using the cmd library.