How do I execute command on Rust API Hook

So I am trying to execute the "/clan" command whenever a player presses the "Create Team" button in the bottom left. I just can't get it to execute the command when pressing the button. I have tried logging "It works" whenever I press the button so the hook is working. I just need to find out a way to execute the command.

object OnTeamCreate(BasePlayer player)

{

ConsoleSystem.Run(ConsoleSystem.Option.Server.Quiet(), "clan");

return false;
}

Most chat commands expect a player, so generally you'd want to be running a console command instead.

I managed to find a solution. This worked for me! I am not sure if it is optimal but it solved the problem so I am satisfied with it! Could you just take a look at my code and see if you can find any errors? I don't want the plugin to crash my server haha. This is my first plugin ever by the way. (Not really a plugin)

using System;

namespace Oxide.Plugins
{
    [Info("DisableTeam", "Hyppa", "0.1")]
    [Description("Disable the Create Team Button")]

    public class DisableTeam : RustPlugin
    {
        object OnTeamCreate(BasePlayer player)
        {
            if(player != null) {
                player.SendConsoleCommand("clan");
                return false;
            }

            return false;
        }
    }
}

FYI you can also run chat commands with the "chat.say" command.

For example:

player.SendConsoleCommand("chat.say /clan");​

Ah, that worked as well! Thanks! By the way, do you guys know if there is any Discord for Oxide Developers? If not, have you thought about making one? Could be really useful for people who want to ask questions and so on. That way, everyone can help each other with tips and tricks and so on. Thanks again! :)

847T1xHJCLqCfGN.jpg Hyppa

Ah, that worked as well! Thanks! By the way, do you guys know if there is any Discord for Oxide Developers? If not, have you thought about making one? Could be really useful for people who want to ask questions and so on. That way, everyone can help each other with tips and tricks and so on. Thanks again! :)

https://umod.org/discord