Пример #1
0
        public void CMD_RemoveHouse(Client player)
        {
            int RightsLevel = PlayerFunctions.Player.GetRightsLevel(player);

            if (RightsLevel < 9)
            {
                player.sendChatMessage("~r~ERROR: ~w~Эта команда вам недоступна.");
                return;
            }

            if (!player.hasData("HouseMarker_ID"))
            {
                player.sendChatMessage("~r~ERROR: ~w~Встаньте на маркер дома который хотите изменить.");
                return;
            }

            House house = Main.Houses.FirstOrDefault(h => h.ID == player.getData("HouseMarker_ID"));

            if (house == null)
            {
                return;
            }

            house.Destroy();
            Main.Houses.Remove(house);

            string house_file = Main.HOUSE_SAVE_DIR + Path.DirectorySeparatorChar + house.ID + ".json";

            if (File.Exists(house_file))
            {
                File.Delete(house_file);
            }
        }
        public void CMD_RemoveHouse(Client player)
        {
            if (!player.hasData("HouseMarker_ID"))
            {
                player.sendChatMessage("~r~ERROR: ~w~Stand in the entrance marker of the house you want to remove.");
                return;
            }

            House house = Main.Houses.FirstOrDefault(h => h.ID == player.getData("HouseMarker_ID"));

            if (house == null)
            {
                return;
            }

            house.Destroy();
            Main.Houses.Remove(house);

            string house_file = Main.HOUSE_SAVE_DIR + Path.DirectorySeparatorChar + house.ID + ".json";

            if (File.Exists(house_file))
            {
                File.Delete(house_file);
            }
        }