diff --git a/zone/command.cpp b/zone/command.cpp index 24e0ab814..b28317c08 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -229,7 +229,7 @@ int command_init(void) command_add("kick", "[charname] - Disconnect charname", AccountStatus::GMLeadAdmin, command_kick) || command_add("kill", "- Kill your target", AccountStatus::GMAdmin, command_kill) || command_add("killallnpcs", " [npc_name] Kills all npcs by search name, leave blank for all attackable NPC's", AccountStatus::GMMgmt, command_killallnpcs) || - command_add("lastname", "[new lastname] - Set your or your player target's lastname", AccountStatus::Guide, command_lastname) || + command_add("lastname", "[Last Name] - Set you or your player target's lastname", AccountStatus::Guide, command_lastname) || command_add("level", "[level] - Set your or your target's level", AccountStatus::Steward, command_level) || command_add("list", "[npcs|players|corpses|doors|objects] [search] - Search entities", AccountStatus::ApprenticeGuide, command_list) || command_add("listpetition", "- List petitions", AccountStatus::Guide, command_listpetition) || diff --git a/zone/gm_commands/lastname.cpp b/zone/gm_commands/lastname.cpp index 09bed4771..a990785d9 100755 --- a/zone/gm_commands/lastname.cpp +++ b/zone/gm_commands/lastname.cpp @@ -2,18 +2,36 @@ void command_lastname(Client *c, const Seperator *sep) { - Client *t = c; - + Client *target = c; if (c->GetTarget() && c->GetTarget()->IsClient()) { - t = c->GetTarget()->CastToClient(); + target = c->GetTarget()->CastToClient(); } - LogInfo("#lastname request from [{}] for [{}]", c->GetName(), t->GetName()); - if (strlen(sep->arg[1]) <= 70) { - t->ChangeLastName(sep->arg[1]); - } - else { - c->Message(Chat::White, "Usage: #lastname where is less than 70 chars long"); + LogInfo("#lastname request from [{}] for [{}]", c->GetCleanName(), target->GetCleanName()); + + std::string last_name = sep->arg[1]; + if (last_name.size() > 64) { + c->Message(Chat::White, "Usage: #lastname [Last Name] (Last Name must be 64 characters or less)"); + return; } + + target->ChangeLastName(last_name.c_str()); + c->Message( + Chat::White, + fmt::format( + "{} now {} a last name of '{}'.", + ( + c == target ? + "You" : + fmt::format( + "{} ({})", + target->GetCleanName(), + target->GetID() + ) + ), + c == target ? "have" : "has", + last_name + ).c_str() + ); }