1. Code:
    using UnityEngine;namespace Oxide.Plugins
    {
        [Info("Corpses", "Steven", "1.0.1", ResourceId = 8913)]
        class Corpses : RustPlugin
        {
            [ConsoleCommand("deadclean")]
            private void consoleDeadClean(ConsoleSystem.Arg arg, BasePlayer player, string command, string[] args)
            {            if (arg.connection != null)
                {
                    int count = 0;
                    var c = Resources.FindObjectsOfTypeAll<PlayerCorpse>();
                    for (int i = 0; i < c.Length - 1; i++)
                    {
                        count++;      
                        c.KillMessage();
                    }
                    SendReply(player, "Deleted " + count + " Dead Corpses.");
                }
            }
          
            [ConsoleCommand("deadcount")]
            private void consoledeadcount(ConsoleSystem.Arg arg, BasePlayer player, string command, string[] args)
            {            if (arg.connection != null)
                {
                    int count = 0;
                    foreach(PlayerCorpse c in Resources.FindObjectsOfTypeAll<PlayerCorpse>()) count++;
                    SendReply(player, count-1 + " Dead Corpses Found.");
                }
            }
        }
    }
     
  2. Wulf

    Wulf Community Admin

    Console commands only take one argument:
    Code:
    consoleDeadClean(ConsoleSystem.Arg arg)
    You'd have to get the connection/player and other arguments from arg:
    Code:
    var player = arg.connection.player as BasePlayer;
    or
    Code:
    var player = (BasePlayer)arg.connection.player;
    or
    Code:
    var player = arg.connection.player.ToPlayer();
    You'd also need to check if player is null or not if you expect to send a reply to that player, otherwise just send a reply to the connection or use Puts to print a message to the server log/console if you don't need the player.