Can't get OnPlayerChat hook to workSolved
Trying to make a population plugin to display server population when someone types !players or !pop, but nothing happens when it is typed.
I would like it if it worked in team chat as well. Any suggestions?

using Rust;

namespace Oxide.Plugins
{
	[Info("Population", "Zeeth", "1.0")]
	public class Population : RustPlugin
	{
    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.");           
            }
			else if (message.Contains("!wipe"))
			{
				rust.BroadcastChat($"The last wipe was {SaveRestore.SaveCreatedTime}, the next wipe will be the first Thursday of the month.");
			}
            else if (message.Contains("!pop"))
            {
                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.");                
            }
        }
	}
}​

What am I doing wrong? Is it because I am using better chat? Do I need to use some sort of other hook?

You don't have the correct arguments for that hook, so it is not being called.

Correct args are: (BasePlayer player, string message, Chat.ChatChannel channel)

5f542b9181eac.png 0x89A

You don't have the correct arguments for that hook, so it is not being called.

Correct args are: (BasePlayer player, string message, Chat.ChatChannel channel)

Thank you very much that worked.
Is there a new command for

{SaveRestore.SaveCreatedTime}

?
Because it no longer works.

Also is there a way to call the current server time like the player chat is in this plugin? 

Locked automatically