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

    Wulf Community Admin

    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. ok, so how to call a hurtworld plugin command from covalence plugin?
     
  4. Wulf

    Wulf Community Admin

    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. 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

    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. So, what is the correct attribute?
     
  8. Wulf

    Wulf Community Admin

    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.