1. Hello in my plugin I would like the player on which I work sends a chat command used in another plugin.
    Is it possible? And if is yes how i can do it please??
    I try this :
    Code:
    SendReply(player, string.Format("/transfert 76561198007607899 2500"));  
    but it is not working he send just text not a command.
    Can you help me please??
     
  2. It's not possible with chat commands. Only with console commands.
     
  3. I never used other plugins within one of my plugins but would it not be possible to simply call the function from the other plugin straight and pass it whatever BasePlayer? This would bypass the / command but have the same result.. I do not know if you can straight out call another function like that in another plugin though or if they need to be exposed as API functions or whatever.
     
  4. Wulf

    Wulf Community Admin

    You, you can. Just use the CallHook function. You can see examples of this on my Push API or Email API plugin Overviews.
     
  5. The plugin is in Lua, i don't understand lua. can you give me the hook for c# please??
     
  6. Wulf

    Wulf Community Admin

    It doesn't matter if that plugin is in Lua, I'm only referring to the examples on its Overview, which you can see in C# as well.
     
  7. Code:
     [ConsoleCommand("plugin.save")]
            private void SaveCommand(ConsoleSystem.Arg arg)
            {
                PrintToConsole(arg.Player(), "Saving the world data");
                SaveRestore.Save();
            }

    it this command??
    can you explain me the argument please?
    Thanks for your help
     
  8. Wulf

    Wulf Community Admin

    The easiest way to explain that is by decompiling the Rust Assembly-CSharp.dll and viewing the ConsoleSystem.Arg method.

    To call that though, you'd use the PluginReference and CallHook like shown in my previously mentioned examples, though there wouldn't be much point, as you could just use SaveRestore.Save() directly in your own plugin.
     
  9. Hum sorry but i don't understand, i have decompil the file but i dont understand.
    In the file i have the method :

    Code:
        public static void SendClientCommand(List<Connection> cn, string strCommand, params object[] args)
        {
            if (!Net.sv.IsConnected())
            {
                return;
            }
            Net.sv.write.Start();
            Net.sv.write.PacketID(Message.Type.ConsoleCommand);
            Net.sv.write.String(ConsoleSystem.BuildCommand(strCommand, args));
            Net.sv.write.Send(new SendInfo(cn));
        }
    The connection is my player object?? is it? and what is the args argument please?

    I explain again my problem. I use the plugin economics LUA and the plugin Human NPC c#.
    In my plugin (c#) i would like to call command on this two plugins. For the NPC i use a Hook but for the plugin economics he have no hook so i would like send a command console tu use that plugin.
    Sorry for the translate and if i'am a beginner....
     
  10. Wulf

    Wulf Community Admin

    What function are you trying to call in HumanNPC exactly?
     
  11. Code:
    void OnUseNPC(BasePlayer npc, BasePlayer player)
            {
              
                var items = ItemManager.GetItemDefinitions();            var newMenu = new Dictionary<string, int>();
                if(npc.displayName.Equals("Armurier")){
                    CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "AddUI", translatedJson);
                    foreach (var item in items)
                    {
                        if((Convert.ToString(item.shortname)).Equals("smg.thompson")){
                            newMenu.Add(Convert.ToString(item.shortname), 2);
                            SendReply(player, string.Format(item.shortname));
                            SendReply(player, string.Format("/transfert 76561198007605992 2500"));
                            player.inventory.GiveItem(ItemManager.CreateByItemID((int)item.itemid, 1, false), (ItemContainer)((BasePlayer)player).inventory.containerMain);
                        }
                    }
                }        }
            
    This method working but now i would like when i say :
    SendReply(player, string.Format("/transfert 76561198007605992 2500"));
    Use a command of plugin economics "/transfert 76561198007605992 2500"
    I don't know if you understand with my bad translation sorry
    [DOUBLEPOST=1439493866][/DOUBLEPOST]Nobody have an idea?
    [DOUBLEPOST=1439547183,1439491978][/DOUBLEPOST]Ok I resolved my problem, solution :

    Code:
    var monsteamID = player.userID.ToString();
    ConsoleSystem.Run.Server.Normal("eco.c deposit "+monsteamID+" -2500");
    Thanks all