Skip to content

Commit

Permalink
For jumpheight setting in /hacks, user should be able to input height…
Browse files Browse the repository at this point in the history
… in decimal (instead of cryptic 'unit of 32')
  • Loading branch information
UnknownShadow200 committed Jul 2, 2017
1 parent 1617f8b commit f3f57f5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions fCraft/Commands/CpeCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2151,16 +2151,19 @@ static void HackControlHandler(Player player, CommandReader cmd) {
case "jump":
case "height":
case "jh":
short height;
float height;
string third = cmd.Next();
if (short.TryParse(third, out height)) {
if (!float.TryParse(third, out height)) {
player.Message("Error: Could not parse \"&a{0}&S\" as a decimal.", third);
return;
} else if (height < 0 || height > short.MaxValue / 32.0f) {
player.Message("Error: Jump height must be between &a0&S and &a1023.", third);
return;
} else {
player.Message("Hacks for {0}", target.ClassyName);
player.Message(" JumpHeight: &a{0} &S--> &a{1}", target.JumpHeight, height);
target.JumpHeight = height;
player.Message(" JumpHeight: &a{0} &S--> &a{1}", target.JumpHeight / 32.0f, height);
target.JumpHeight = (short)(height * 32);
hackStr = "jumpheight";
} else {
player.Message("Error: Could not parse \"&a{0}&S\" as a short. Try something between &a0&S and &a32767", third);
return;
}
break;
default:
Expand Down

0 comments on commit f3f57f5

Please sign in to comment.