I made a plugin

Discussion in 'Off Topic' started by Nick!, Oct 11, 2017.

  1. Nick!

    Nick! Scavenger

    myfirstplugin.png
    I CANT BELIEVE IT OMG
     
  2. Ryan

    Ryan Master Researcher Plugin Developer

    gratss
     
  3. Nick!

    Nick! Scavenger

    Ty, I am currently in the process of making a plug-in that tells the server when it saves
    --- Double Post Merged, Oct 11, 2017 ---
    Also do you know how to broadcast messages to just one specific person?
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    PS. There's already a plugin that tells when the server saves. ;)

    There are a lot of examples of plugins that send messages to specific players too by the way.
     
  5. Nick!

    Nick! Scavenger

    could u link me?
    --- Double Post Merged, Oct 11, 2017 ---
    I want it to broadcast a message to the admins, just for me. Im probably not going to upload it.
     
  6. Kappasaurus

    Kappasaurus Shotgun Ace Plugin Developer

    Code (C#):
            protected override void LoadDefaultMessages() => lang.RegisterMessages(new Dictionary<string, string>
            {
                {"MyMessage", "This is my message."}
            }, this);

            private string Lang(BasePlayer player, string key, params object[] args)
            {
                var message = lang.GetMessage(key, this, player.UserIDString);
                if (args.Length != 0)
                    message = string.Format(message, args);

                return covalence.FormatText(message);
            }

            // ...
     
            foreach (var admin in BasePlayer.activePlayerList.Where(a => a.IsAdmin))
                PrintToChat(admin, Lang(admin, "MyMessage"));
    There's the basics, register your message, then loop all admins and send it. You don't absolutely need Lang, you can use lang.GetMessage, however when working with complex messages a helper like that is useful.
     
    Last edited: Oct 11, 2017