1. Im trying to make the player count show in chat when a player enters !players in the chat. Here is what i came up with but its not workong, someone help?

    Thank you
     
    Last edited by a moderator: Jan 21, 2018
  2. PlayerList

    This should help you out with what you want and should accommodate additional features that you may seek.
     
  3. Wulf

    Wulf Community Admin

    Ah, the deceptive modded as vanilla !players command. :p
     
  4. Wulf

    Wulf Community Admin

  5. So this? Bare with me im new at this

    Code:
    using Rust;namespace Oxide.Plugins
    {
    [Info("PlayerCount", "Hougan", "0.0.1")]
    public class PlayerCount : RustPlugin
    {
        void OnPlayerChat(ConsoleSystem.Arg arg)
            {
                var message = arg.GetString(0);
                if (message.Contains("!players"))
                {
                    var playerCount = BasePlayer.activePlayerList
                    if (playerCount > 1)
                        rust.BroadcastChat($"There are currently {playerCount} players online.");
                    else
                        rust.BroadcastChat("There is currently 1 player online.");             
                }
            }
    }
     
  6. Code:
    var playerCount = BasePlayer.activePlayerList
    Wouldn't be a bad idea to put a ; at the end

    Edit: and also you are checking
    Code:
    if (playerCount > 1)
    that cant work because playerCount is a list, you should do
    Code:
    if (playerCount.Count > 1)
     
  7. Mysteriously my code I posted on the forums a while back has the end of the line cut off with the author @HOUGAN_Y . :p Below is the code from the original post.
    Code:
    void OnPlayerChat(ConsoleSystem.Arg arg)
    {
        var message = arg.GetString(0);
        if(message.Contains("!players"))
        {
            var playerCount = BasePlayer.activePlayerList.Count;
            if(playerCount >1)
                rust.BroadcastChat($"There are currently {playerCount} players online.");
            else
                rust.BroadcastChat("There is currently 1 player online.");
        }
    }
     
    Last edited by a moderator: Jan 21, 2018
  8. Kappasaurus i tried pming you lol, i had it someone keeps editing my code post im guessing they dont want full code on the forums..
     
  9. Where should I put this script in, what file, or do I need to create a new one?
     
  10. Hi all, im tryin to understand how to make this plugin.. i also need it badly for my server can someone PM me the full plugin code ? so i can have a look at it and learn it and use it ? Thanks!
     
  11. Wulf

    Wulf Community Admin

    Look at plugins such as AutoReply, the existing PlayersList plugin, etc. This thread isn't here to be a full plugin, it's meant to show how to do it. The basics to plugin development can be found on this forum, in existing plugins, and our Docs. The example of what to do specific to this thread is in the post above. Solved - Getting player count and showing in chat?