Kinglykrab e43538cf73
[Commands] Cleanup #kill Command. (#2195)
- Cleanup messages and logic.
2022-05-22 22:31:08 -04:00

29 lines
472 B
C++
Executable File

#include "../client.h"
void command_kill(Client *c, const Seperator *sep)
{
auto target = c->GetTarget();
if (!target) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
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();
}
}