本文整理汇总了C#中ConsoleSystem.ReplyWith方法的典型用法代码示例。如果您正苦于以下问题:C# ConsoleSystem.ReplyWith方法的具体用法?C# ConsoleSystem.ReplyWith怎么用?C# ConsoleSystem.ReplyWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleSystem
的用法示例。
在下文中一共展示了ConsoleSystem.ReplyWith方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCharacterStuff
private static bool GetCharacterStuff(ref ConsoleSystem.Arg args, out Character character, out CameraMount camera, out ItemRepresentation itemRep, out ArmorModelRenderer armor)
{
character = null;
itemRep = null;
armor = null;
camera = CameraMount.current;
if (!camera)
{
args.ReplyWith("Theres no active camera mount.");
return false;
}
character = IDBase.GetMain(camera) as Character;
if (!character)
{
args.ReplyWith("theres no character for the current mounted camera");
return false;
}
armor = character.GetLocal<ArmorModelRenderer>();
InventoryHolder local = character.GetLocal<InventoryHolder>();
if (local)
{
itemRep = local.itemRepresentation;
}
return true;
}
示例2: Execute
public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
{
string displayName;
string str2 = "";
for (int i = 0; i < ChatArguments.Length; i++)
{
str2 = str2 + ChatArguments[i] + " ";
}
str2 = str2.Trim();
if (str2 == "")
{
displayName = Arguments.argUser.displayName;
}
else
{
if (!Administrator.IsAdmin(Arguments.argUser.userID))
{
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Only administrators can ask for another player's location.");
return;
}
displayName = str2;
}
foreach (PlayerClient client in PlayerClient.FindAllWithString(displayName))
{
string strValue = string.Concat(new object[] { "Location: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z });
Arguments.ReplyWith(strValue);
Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, string.Concat(new object[] { (str2 == "") ? "Your" : (displayName + "'s"), " Location Is: X: ", (int)client.lastKnownPosition.x, " Y: ", (int)client.lastKnownPosition.y, " Z: ", (int)client.lastKnownPosition.z }));
}
}
示例3: reload
public static void reload(ConsoleSystem.Arg arg)
{
if (PluginLoader.GetInstance().Plugins.ContainsKey(arg.ArgsStr)) {
PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr);
arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr));
} else if (arg.ArgsStr == "") {
DirectoryConfig.GetInstance().Reload();
CoreConfig.GetInstance().Reload();
Config.GetInstance().Reload();
Server.GetInstance().LoadLoadouts();
if (Server.GetInstance().Loaded)
Hooks.On_ServerInit();
PluginLoader.GetInstance().ReloadPlugins();
arg.ReplyWith("Pluton reloaded!");
var planes = (from plane in UnityEngine.Object.FindObjectsOfType<CargoPlane>()
where plane.transform.position.x == 0f && plane.transform.position.z == 0f
select plane).ToList();
planes.ForEach(p => p.SendMessage("KillMessage", UnityEngine.SendMessageOptions.DontRequireReceiver));
if (planes.Count != 0) {
Pluton.Logger.LogWarning(String.Format("Destroyed {0} plane at Vector3.zero", planes.Count));
}
} else {
arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr));
}
}
示例4: kick
public static void kick(ConsoleSystem.Arg arg)
{
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Kick("Kicked by: " + nameFrom);
Server.GetInstance().Broadcast(arg.ArgsStr + " is kicked from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is kicked!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
示例5: login
public static void login(ConsoleSystem.Arg arg)
{
if (arg.connection != null && arg.ArgsStr == rcon.password) {
ServerUsers.Set(arg.connection.userid, ServerUsers.UserGroup.Moderator, arg.connection.username, "Console login!");
ServerUsers.Save();
arg.ReplyWith("You are a moderator now!");
}
}
示例6: time
public static void time(ref ConsoleSystem.Arg arg)
{
if (!EnvironmentControlCenter.Singleton)
{
return;
}
float time = EnvironmentControlCenter.Singleton.GetTime();
arg.ReplyWith(string.Concat("Current Time: ", time.ToString()));
}
示例7: save
public static void save(ref ConsoleSystem.Arg arg)
{
if (!Directory.Exists("cfg"))
{
Directory.CreateDirectory("cfg");
}
File.WriteAllText(config.ConfigName(), ConsoleSystem.SaveToConfigString());
arg.ReplyWith("Saved config.cfg");
}
示例8: Loaded
public static void Loaded(ConsoleSystem.Arg args)
{
int count = PluginLoader.GetInstance().Plugins.Count;
string result = String.Format("Loaded plugins({0}):" + Environment.NewLine, count);
foreach (BasePlugin plugin in PluginLoader.GetInstance().Plugins.Values) {
result += String.Format(" {0, -22} [{1, -10}], timers: {2, 8}, parallel: {3, 8}\r\n", plugin.Name, plugin.Type, plugin.Timers.Count + plugin.ParallelTimers.Count, plugin.ParallelTimers.Count);
result += String.Format("Author: {0}, about: {1}, version: {2}" + Environment.NewLine + Environment.NewLine, plugin.Author, plugin.About, plugin.Version);
}
args.ReplyWith(result);
}
示例9: load
public static void load(ref ConsoleSystem.Arg arg)
{
string str = config.ConfigName();
string str1 = "\r\necho default config\r\ninput.bind Left A None\r\ninput.bind Right D None\r\ninput.bind Up W None\r\ninput.bind Down S None\r\ninput.bind Jump Space None\r\ninput.bind Duck LeftControl None\r\ninput.bind Sprint LeftShift None\r\ninput.bind Fire Mouse0 None\r\ninput.bind AltFire Mouse1 None\r\ninput.bind Reload R None\r\ninput.bind Use E None\r\ninput.bind Inventory Tab None\r\ninput.bind Flashlight F None\r\ninput.bind Laser G None\r\ninput.bind Voice V None\r\ninput.bind Chat Return T\r\nrender.update\r\n";
if (File.Exists(str))
{
str1 = File.ReadAllText(str);
}
ConsoleSystem.RunFile(str1);
arg.ReplyWith(string.Concat("Loaded ", str));
}
示例10: Hooks
public static void Hooks(ConsoleSystem.Arg args)
{
Dictionary<string, List<string>> hooks = new Dictionary<string, List<string>>();
PluginLoader.GetInstance().Plugins.Values.ToList().ForEach(
p => p.Globals.ToList().ForEach(
g => {
if (g.StartsWith("On_"))
AddPluginToHookListInDict(hooks, g, p.Name);
}));
string result = "The registered hooks are:" + Environment.NewLine;
hooks.Keys.ToList().ForEach(k => {
result += k + ": " + String.Join(", ", hooks[k].ToArray()) + Environment.NewLine;
});
args.ReplyWith(result);
}
示例11: CmdShow
private void CmdShow(ConsoleSystem.Arg arg)
{
if (!PermissionsLoaded(arg)) return;
if (!IsAdmin(arg)) return;
if (!arg.HasArgs())
{
ReplyWith(arg.connection, "CommandUsageShow");
return;
}
var mode = arg.GetString(0);
var name = arg.GetString(1);
if (mode.Equals("perms"))
{
var result = "Permissions:\n";
result += string.Join(", ", permission.GetPermissions());
arg.ReplyWith(result);
}
else if (mode.Equals("user"))
{
var player = FindPlayer(name);
if (player == null && !permission.UserExists(name))
{
ReplyWith(arg.connection, "UserNotFound");
return;
}
var userId = name;
if (player != null)
{
userId = player.userID.ToString();
name = player.displayName;
permission.UpdateNickname(userId, name);
name += $" ({userId})";
}
var result = "User '" + name + "' permissions:\n";
result += string.Join(", ", permission.GetUserPermissions(userId));
result += "\nUser '" + name + "' groups:\n";
result += string.Join(", ", permission.GetUserGroups(userId));
arg.ReplyWith(result);
}
else if (mode.Equals("group"))
{
if (!permission.GroupExists(name))
{
ReplyWith(arg.connection, "GroupNotFound", name);
return;
}
var result = "Group '" + name + "' users:\n";
result += string.Join(", ", permission.GetUsersInGroup(name));
result += "\nGroup '" + name + "' permissions:\n";
result += string.Join(", ", permission.GetGroupPermissions(name));
var parent = permission.GetGroupParent(name);
while (permission.GroupExists(parent))
{
result = "\nParent group '" + parent + "' permissions:\n";
result += string.Join(", ", permission.GetGroupPermissions(parent));
parent = permission.GetGroupParent(parent);
}
arg.ReplyWith(result);
}
else if (mode.Equals("groups"))
{
var result = "Groups:\n";
result += string.Join(", ", permission.GetGroups());
arg.ReplyWith(result);
}
}
示例12: CmdPlugins
private void CmdPlugins(ConsoleSystem.Arg arg)
{
if (!IsAdmin(arg)) return;
var loaded_plugins = pluginmanager.GetPlugins().Where(pl => !pl.IsCorePlugin).ToArray();
var loaded_plugin_names = new HashSet<string>(loaded_plugins.Select(pl => pl.Name));
var unloaded_plugin_errors = new Dictionary<string, string>();
foreach (var loader in Interface.Oxide.GetPluginLoaders())
{
foreach (var name in loader.ScanDirectory(Interface.Oxide.PluginDirectory).Except(loaded_plugin_names))
{
string msg;
unloaded_plugin_errors[name] = (loader.PluginErrors.TryGetValue(name, out msg)) ? msg : "Unloaded";
}
}
var total_plugin_count = loaded_plugins.Length + unloaded_plugin_errors.Count;
if (total_plugin_count < 1)
{
ReplyWith(arg.connection, "NoPluginsFound");
return;
}
var output = $"Listing {loaded_plugins.Length + unloaded_plugin_errors.Count} plugins:";
var number = 1;
foreach (var plugin in loaded_plugins)
output += $"\n {number++:00} \"{plugin.Title}\" ({plugin.Version}) by {plugin.Author} ({plugin.TotalHookTime:0.00}s)";
foreach (var plugin_name in unloaded_plugin_errors.Keys)
output += $"\n {number++:00} {plugin_name} - {unloaded_plugin_errors[plugin_name]}";
arg.ReplyWith(output);
}
示例13: cmdVersion
private void cmdVersion(ConsoleSystem.Arg arg)
{
// Get the Rust network protocol version at runtime
var protocol = typeof(Protocol).GetField("network").GetValue(null).ToString();
// Get the Oxide Core version
var oxide = OxideMod.Version.ToString();
// Show the versions
if (!string.IsNullOrEmpty(protocol) && !string.IsNullOrEmpty(oxide))
{
arg.ReplyWith("Oxide Version: " + oxide + ", Rust Protocol: " + protocol);
}
}
示例14: status
public static void status(ConsoleSystem.Arg arg)
{
UnityEngine.Debug.Log(CountedInstance.InstanceReportText());
arg.ReplyWith("Finished report!");
}
示例15: find
public static void find(ref ConsoleSystem.Arg arg)
{
string str;
if (!arg.HasArgs(1))
{
return;
}
string args = arg.Args[0];
string empty = string.Empty;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
for (int i = 0; i < (int)assemblies.Length; i++)
{
Type[] types = assemblies[i].GetTypes();
for (int j = 0; j < (int)types.Length; j++)
{
if (types[j].IsSubclassOf(typeof(ConsoleSystem)))
{
MethodInfo[] methods = types[j].GetMethods();
for (int k = 0; k < (int)methods.Length; k++)
{
if (methods[k].IsStatic)
{
if (!(args != "*") || types[j].Name.Contains(args) || methods[k].Name.Contains(args))
{
if (arg.CheckPermissions(methods[k].GetCustomAttributes(true)))
{
str = empty;
empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildMethodString(ref methods[k]), "\n" });
}
}
}
}
FieldInfo[] fields = types[j].GetFields();
for (int l = 0; l < (int)fields.Length; l++)
{
if (fields[l].IsStatic)
{
if (!(args != "*") || types[j].Name.Contains(args) || fields[l].Name.Contains(args))
{
if (arg.CheckPermissions(fields[l].GetCustomAttributes(true)))
{
str = empty;
empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildFieldsString(ref fields[l]), "\n" });
}
}
}
}
PropertyInfo[] properties = types[j].GetProperties();
for (int m = 0; m < (int)properties.Length; m++)
{
if (!(args != "*") || types[j].Name.Contains(args) || properties[m].Name.Contains(args))
{
if (arg.CheckPermissions(properties[m].GetCustomAttributes(true)))
{
str = empty;
empty = string.Concat(new string[] { str, types[j].Name, ".", global.BuildPropertyString(ref properties[m]), "\n" });
}
}
}
}
}
}
arg.ReplyWith(string.Concat("Finding ", args, ":\n", empty));
}