[Crash] Bugfix for zone crash caused by #flymode -1 (#1291)

* Update command.cpp

Fixed typo in the command description.

* Bugfix for #flymode zone crash

Bugfix for #flymode zone crash when invalid values are passed. Also, when entering #flymode without parameters, the correct syntax is now displayed.

* Changed as requested
This commit is contained in:
Thalix 2021-03-16 06:03:35 +01:00 committed by GitHub
parent 18a3ff5f12
commit 5035451af7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2642,9 +2642,7 @@ void command_flymode(Client *c, const Seperator *sep)
{
Mob *t = c;
if (strlen(sep->arg[1]) == 1 && !(sep->arg[1][0] == '0' || sep->arg[1][0] == '1' || sep->arg[1][0] == '2' || sep->arg[1][0] == '3' || sep->arg[1][0] == '4' || sep->arg[1][0] == '5'))
c->Message(Chat::White, "#flymode [0/1/2/3/4/5]");
else {
if (strlen(sep->arg[1]) == 1 && sep->IsNumber(1) && atoi(sep->arg[1]) >= 0 && atoi(sep->arg[1]) <= 5) {
if (c->GetTarget()) {
t = c->GetTarget();
}
@ -2671,9 +2669,12 @@ void command_flymode(Client *c, const Seperator *sep)
else if (sep->arg[1][0] == '5') {
c->Message(Chat::White, "Setting %s to Levitating While Running", t->GetName());
}
} else {
c->Message(Chat::White, "#flymode [0/1/2/3/4/5]");
}
}
void command_showskills(Client *c, const Seperator *sep)
{
Client *t=c;