Skip to content
Prev Previous commit
Next Next commit
Added command to Kill given player instantly
  • Loading branch information
LordTylus committed Nov 23, 2019
commit 6d6bd92806b3db1c8ce5ef2eb37812bcf7dd94db
17 changes: 17 additions & 0 deletions Essentials/Commands/PlayerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using VRage.Game.ModAPI;
using VRage.ModAPI;
using Torch.API.Managers;
using Sandbox.Game;

namespace Essentials
{
Expand Down Expand Up @@ -102,6 +103,22 @@ public void Whisper(string playerName)
Context.Torch.CurrentSession?.Managers?.GetManager<IChatManagerServer>()?.SendMessageAsOther(message, Context.Player?.DisplayName ?? "Server", MyFontEnum.Red, player.SteamUserId);
}

[Command("kill", "Kills a player.")]
[Permission(MyPromoteLevel.Moderator)]
public void Kill(string playerName)
{
var player = Utilities.GetPlayerByNameOrId(playerName);
if (player != null)
{
MyVisualScriptLogicProvider.SetPlayersHealth(player.IdentityId, 0);
Context.Respond($"Player '{player.DisplayName}' killed.");
}
else
{
Context.Respond("Player not found.");
}
}

[Command("kick", "Kick a player from the game.")]
[Permission(MyPromoteLevel.Moderator)]
public void Kick(string playerName)
Expand Down