Пример #1
0
 public async Task EnterHotel(IPlayer player, int hotelId, int apartmentId)
 {
     try
     {
         if (player == null || !player.Exists || hotelId <= 0 || apartmentId <= 0)
         {
             return;
         }
         int charId = User.GetPlayerOnline(player);
         if (charId <= 0)
         {
             return;
         }
         if (!ServerHotels.ExistHotelApartment(hotelId, apartmentId))
         {
             HUDHandler.SendNotification(player, 3, 5000, "Ein unerwarteter Fehler ist aufgetreten [HOTEL-001]."); return;
         }
         if (ServerHotels.GetApartmentOwner(hotelId, apartmentId) <= 0)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Dieses Zimmer ist nicht vermietet."); return;
         }
         var hotel = ServerHotels.ServerHotelsApartments_.FirstOrDefault(x => x.hotelId == hotelId && x.id == apartmentId);
         if (hotel == null)
         {
             return;
         }
         if (!player.Position.IsInRange(ServerHotels.GetHotelPosition(hotelId, apartmentId), 3f))
         {
             return;
         }
         if (hotel.isLocked)
         {
             HUDHandler.SendNotification(player, 3, 5000, "Fehler: Das Zimmer ist abgeschlossen."); return;
         }
         if (!ServerHouses.ExistInteriorId(hotel.interiorId))
         {
             return;
         }
         player.Position  = ServerHouses.GetInteriorExitPosition(hotel.interiorId);
         player.Dimension = 5000 + apartmentId;
     }
     catch (Exception e)
     {
         Alt.Log($"{e}");
     }
 }