Skip to content

Commit

Permalink
[Crash] Bugfix for zone crash caused by #flymode -1 (#1291)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Thalix authored Mar 16, 2021
1 parent 18a3ff5 commit 5035451
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zone/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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;
Expand Down

0 comments on commit 5035451

Please sign in to comment.