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."); } } } }
Solved Console command unresponsive (invalid arguments)
Discussion in 'Rust Development' started by Top 2, Jun 16, 2016.
-
Wulf Community Admin
Console commands only take one argument:
Code:consoleDeadClean(ConsoleSystem.Arg arg)
Code:var player = arg.connection.player as BasePlayer;
Code:var player = (BasePlayer)arg.connection.player;
Code:var player = arg.connection.player.ToPlayer();