void HandleGenerate(Player p, string arg1, string arg2, string arg3) { int width, height, length; if (!int.TryParse(arg1, out width) || !int.TryParse(arg2, out height) || !int.TryParse(arg3, out length)) { width = 32; height = 32; length = 32; } if (width < 32 || !MapGen.OkayAxis(width)) { width = 32; } if (height < 32 || !MapGen.OkayAxis(height)) { height = 32; } if (length < 32 || !MapGen.OkayAxis(length)) { length = 32; } if (!CmdNewLvl.CheckMapSize(p, width, height, length)) { return; } Level lvl = CountdownMapGen.Generate(width, height, length); lvl.Deletable = false; lvl.Buildable = false; lvl.permissionbuild = LevelPermission.Nobody; lvl.motd = "Welcome to the Countdown map! -hax"; Level oldLvl = LevelInfo.FindExact("countdown"); if (oldLvl != null) { LevelActions.Replace(oldLvl, lvl); } else { LevelInfo.Loaded.Add(lvl); } lvl.Save(); if (Server.Countdown.gamestatus != CountdownGameStatus.Disabled) { Server.Countdown.mapon = lvl; } const string format = "Generated map ({0}x{1}x{2}), sending you to it.."; Player.Message(p, format, width, height, length); PlayerActions.ChangeMap(p, "countdown"); const ushort x = 8 * 32 + 16; const ushort y = 23 * 32 + 32; const ushort z = 17 * 32 + 16; p.SendPos(Entities.SelfID, x, y, z, p.rot[0], p.rot[1]); }
void HandleGenerate(Player p, string arg1, string arg2, string arg3) { int width, height, length; if (!int.TryParse(arg1, out width) || !int.TryParse(arg2, out height) || !int.TryParse(arg3, out length)) { width = 32; height = 32; length = 32; } if (width < 32 || !MapGen.OkayAxis(width)) { width = 32; } if (height < 32 || !MapGen.OkayAxis(height)) { height = 32; } if (length < 32 || !MapGen.OkayAxis(length)) { length = 32; } Level oldLevel = LevelInfo.FindExact("countdown"); if (oldLevel != null) { oldLevel.permissionbuild = LevelPermission.Guest; Command.all.Find("deletelvl").Use(p, "countdown"); } Level lvl = CountdownMapGen.Generate(width, height, length); lvl.Save(); if (Server.Countdown.gamestatus != CountdownGameStatus.Disabled) { Server.Countdown.mapon = lvl; } const string format = "Generated map ({0}x{1}x{2}), sending you to it.."; Player.SendMessage(p, String.Format(format, width, height, length)); Command.all.Find("load").Use(p, "countdown"); Command.all.Find("goto").Use(p, "countdown"); p.level.permissionbuild = LevelPermission.Nobody; p.level.motd = "Welcome to the Countdown map!!!! -hax"; const ushort x = 8 * 32 + 16; const ushort y = 23 * 32 + 32; const ushort z = 17 * 32 + 16; p.SendPos(0xFF, x, y, z, p.rot[0], p.rot[1]); }