diff --git a/zone/command.cpp b/zone/command.cpp index 1fb71af5c..56643a28d 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -221,7 +221,7 @@ int command_init(void) command_add("interrogateinv", "- use [help] argument for available options", AccountStatus::Player, command_interrogateinv) || command_add("interrupt", "[message id] [color] - Interrupt your casting. Arguments are optional.", AccountStatus::Guide, command_interrupt) || command_add("invsnapshot", "- Manipulates inventory snapshots for your current target", AccountStatus::QuestTroupe, command_invsnapshot) || - command_add("invul", "[on/off] - Turn player target's or your invulnerable flag on or off", AccountStatus::QuestTroupe, command_invul) || + command_add("invul", "[On|Off]] - Turn player target's or your invulnerable flag on or off", AccountStatus::QuestTroupe, command_invul) || command_add("ipban", "[IP address] - Ban IP by character name", AccountStatus::GMMgmt, command_ipban) || command_add("iplookup", "[charname] - Look up IP address of charname", AccountStatus::GMMgmt, command_iplookup) || command_add("iteminfo", "- Get information about the item on your cursor", AccountStatus::Steward, command_iteminfo) || diff --git a/zone/gm_commands/invul.cpp b/zone/gm_commands/invul.cpp index 4af42ceaf..a6db1f3c1 100755 --- a/zone/gm_commands/invul.cpp +++ b/zone/gm_commands/invul.cpp @@ -2,19 +2,27 @@ void command_invul(Client *c, const Seperator *sep) { - bool state = atobool(sep->arg[1]); - Client *t = c; + int arguments = sep->argnum; + if (!arguments) { + c->Message(Chat::White, "Usage: #invul [On|Off]"); + return; + } + bool invul_flag = atobool(sep->arg[1]); + Client *target = c; if (c->GetTarget() && c->GetTarget()->IsClient()) { - t = c->GetTarget()->CastToClient(); + target = c->GetTarget()->CastToClient(); } - if (sep->arg[1][0] != 0) { - t->SetInvul(state); - c->Message(Chat::White, "%s is %s invulnerable from attack.", t->GetName(), state ? "now" : "no longer"); - } - else { - c->Message(Chat::White, "Usage: #invulnerable [on/off]"); - } + target->SetInvul(invul_flag); + c->Message( + Chat::White, + fmt::format( + "{} {} now {}.", + c == target ? "You" : target->GetCleanName(), + c == target ? "are" : "is", + invul_flag ? "invulnerable" : "vulnerable" + ).c_str() + ); }