Kinglykrab 8b54bb34e4
[Commands] Cleanup #gmspeed Command. (#1831)
* [Commands] Cleanup #gmspeed Command.
- Cleanup message and logic.

* Update gmspeed.cpp

* Update gmspeed.cpp
2021-11-26 13:56:45 -05:00

56 lines
937 B
C++
Executable File

#include "../client.h"
void command_gmspeed(Client *c, const Seperator *sep)
{
int arguments = sep->argnum;
if (!arguments) {
c->Message(Chat::White, "Usage: #gmspeed [On|Off]");
return;
}
bool gm_speed_flag = atobool(sep->arg[1]);
Client *target = c;
if (c->GetTarget() && c->GetTarget()->IsClient()) {
target = c->GetTarget()->CastToClient();
}
database.SetGMSpeed(
target->AccountID(),
gm_speed_flag ? 1 : 0
);
c->Message(
Chat::White,
fmt::format(
"Turning GM Speed {} for {}.",
gm_speed_flag ? "on" : "off",
(
c == target ?
"yourself" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
).c_str()
);
c->Message(
Chat::White,
fmt::format(
"Note: {} must zone for it to take effect.",
(
c == target ?
"You" :
fmt::format(
"{} ({})",
target->GetCleanName(),
target->GetID()
)
)
).c_str()
);
}