[Commands] #petname changes PC to Nobody if selected. (#3720)

This commit is contained in:
Paul Coene 2023-11-26 14:50:44 -05:00 committed by GitHub
parent 690cacdaab
commit cf1f8d5460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,10 +5,10 @@ void command_petname(Client *c, const Seperator *sep)
Mob *target;
target = c->GetTarget();
if (!target) {
c->Message(Chat::White, "Usage: #petname newname (requires a target)");
if (!target || !target->IsPet()) {
c->Message(Chat::White, "Usage: #petname newname (requires a pet target)");
}
else if (target->IsPet() && (target->GetOwnerID() == c->GetID()) && strlen(sep->arg[1]) > 0) {
else if (target->GetOwnerID() == c->GetID() && strlen(sep->arg[1]) > 0) {
char *oldname = strdup(target->GetName());
target->TempName(sep->arg[1]);
c->Message(Chat::White, "Renamed %s to %s", oldname, sep->arg[1]);