[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) void command_freeze(Client *c, const Seperator *sep)
{ {
if (c->GetTarget() != 0) { if (c->GetTarget()) {
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_FREEZE); auto target = c->GetTarget();
} if (target != c) {
else { target->SendAppearancePacket(AT_Anim, ANIM_FREEZE);
c->Message(Chat::White, "ERROR: Freeze requires a target."); } else {
c->Message(Chat::White, "You cannot freeze yourself.");
}
} 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) void command_unfreeze(Client *c, const Seperator *sep)
{ {
if (c->GetTarget() != 0) { if (!c->GetTarget()) {
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_STAND); c->Message(Chat::White, "You must have a target to use this command.");
} return;
else {
c->Message(Chat::White, "ERROR: Unfreeze requires a target.");
} }
c->GetTarget()->SendAppearancePacket(AT_Anim, ANIM_STAND);
} }