public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments) { string str = ""; for (int i = 0; i < ChatArguments.Length; i++) { str = str + ChatArguments[i] + " "; } str = str.Trim(); PlayerClient client = null; foreach (PlayerClient client2 in PlayerClient.All) { if (client2.netUser.displayName.ToLower() == str.ToLower()) { client = client2; } } if (client != null) { try { Character character; Character.FindByUser(client.userID, out character); IDBase victim = character; TakeDamage.Kill(Arguments.argUser.playerClient, victim, null); Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You killed " + client.netUser.displayName); Util.sayUser(client.netPlayer, Core.Name, Arguments.argUser.displayName + " killed you with his admin power."); } catch (Exception ex) { Logger.LogException(ex); } } }
/// <summary> /// Causes the player's character to die /// </summary> public void Kill() { var character = netUser.playerClient.controllable.idMain; if (character == null || !character.alive) { return; } TakeDamage.Kill(character, character); }
/// <summary> /// Causes the user's character to die /// </summary> public void Kill() { var character = netUser.playerClient.controllable.idMain; if (!character || !character.alive) { return; } DamageEvent damageEvent; TakeDamage.Kill(character, character, out damageEvent); }
public void KillPlayer(PlayerClient victim, PlayerClient myAdmin) { if (victim == myAdmin) { Util.sayUser(myAdmin.netUser.networkPlayer, Core.Name, "Suicide isn't painless. " + Core.Name + " won't let you kill yourself."); } else if (Administrator.IsAdmin(victim.userID) && !Administrator.GetAdmin(myAdmin.userID).HasPermission("RCON")) { Util.sayUser(myAdmin.netUser.networkPlayer, Core.Name, victim.netUser.displayName + " is an administrator. May I suggest a rock?"); } else { Administrator.NotifyAdmins(string.Format("{0} killed {1} with mind bullets.", myAdmin.netUser.displayName, victim.netUser.displayName)); Util.sayUser(victim.netPlayer, myAdmin.netUser.displayName, string.Format("I killed you with mind bullets. That's telekinesis, {1}.", myAdmin.netUser.displayName, victim.netUser.displayName)); TakeDamage.Kill(myAdmin, victim, null); } }