Chat Commands
Example Simple Command Without Permissions
[ChatCommand("discord")]
public static void DiscordCommand(Player player)
{
player.SendChatMessage("You can join our discord at discord.gg/xxxxx");
}A command with a description and a required permission.
[ChatCommand(name: "kickme", permission: "chat.kickme", docs: "Syntax: '/kickme' Kicks yourself from the server.")]
public static void Command_players(Player player)
{
player.Kick("Such an useful command.");
}As an example here is the players command from SDS.
players command from SDS.[ChatCommand(name: "players", permission: "chat.players", docs: "Syntax: '/players' Lists all players in the world.")]
public static string Command_players(Player player, string[] args)
{
List<Player> players = Player.PlayerList.WithoutServerPlayer();
string playerList = string.Join(", ", players.Select(x => x.PlayerName));
return $"Players ({players.Count}): {playerList}.";
}Last updated