[Commands] Cleanup #freeze and #unfreeze Commands. (#2102)

- Cleanup messages and logic.
- Remove the ability to #freeze yourself.
This commit is contained in:
Kinglykrab 2022-05-03 23:05:09 -04:00 committed by GitHub
parent e08afb1234
commit 35044becc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View File

@ -2,11 +2,15 @@
void command_freeze(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0) {
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
if (c->GetTarget()) {
auto target = c->GetTarget();
if (target != c) {
target->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
} else {
c->Message(Chat::White, "You cannot freeze yourself.");
}
else {
c->Message(Chat::White, "ERROR: Freeze requires a target.");
} else {
c->Message(Chat::White, "You must have a target to use this command.");
}
}

View File

@ -2,11 +2,11 @@
void command_unfreeze(Client *c, const Seperator *sep)
{
if (c->GetTarget() != 0) {
if (!c->GetTarget()) {
c->Message(Chat::White, "You must have a target to use this command.");
return;
}
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_STAND);
}
else {
c->Message(Chat::White, "ERROR: Unfreeze requires a target.");
}
}