From e43538cf7346db73bb6aa72efeaff2bd9c47b352 Mon Sep 17 00:00:00 2001 From: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com> Date: Sun, 22 May 2022 22:31:08 -0400 Subject: [PATCH] [Commands] Cleanup #kill Command. (#2195) - Cleanup messages and logic. --- zone/gm_commands/kill.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/zone/gm_commands/kill.cpp b/zone/gm_commands/kill.cpp index d54245662..989df7294 100755 --- a/zone/gm_commands/kill.cpp +++ b/zone/gm_commands/kill.cpp @@ -2,11 +2,27 @@ void command_kill(Client *c, const Seperator *sep) { - if (!c->GetTarget()) { - c->Message(Chat::White, "Error: #Kill: No target."); + auto target = c->GetTarget(); + if (!target) { + c->Message(Chat::White, "You must have a target to use this command."); + return; } - else if (!c->GetTarget()->IsClient() || c->GetTarget()->CastToClient()->Admin() <= c->Admin()) { - c->GetTarget()->Kill(); + + if ( + !target->IsClient() || + target->CastToClient()->Admin() <= c->Admin() + ) { + if (c != target) { + c->Message( + Chat::White, + fmt::format( + "Killing {}.", + c->GetTargetDescription(target) + ).c_str() + ); + } + + target->Kill(); } }