private void CharacterEditorController_OnPlayerFinishedCharacterEditor(Client client, Account e)
        {
            if (e.CurrentCharacter == null)
            {
                logger.Debug($"Player: {client.socialClubName} ({e.Id}) Character is Null");
            }

            CharacterController.ApplyCharacterClothing(client);

            // Spawn at last Position
            if (e.CurrentCharacter.Position == null || e.CurrentCharacter.Position == "" || e.CurrentCharacter.Position.FromJson <Vector3>().DistanceTo(new Vector3(0, 0, 0)) <= 2f)
            {
                AntiCheatController.TeleportPlayer(client, Constants.DefaultSpawnPosition, new Vector3(0, 0, Constants.DefaultSpawnRotation));
                client.position = Constants.DefaultSpawnPosition;
                client.rotation = new Vector3(0, 0, Constants.DefaultSpawnRotation);
                API.sendColoredNotificationToPlayer(client, "Deine Spawnposition war fehlerhaft, deshalb wurdest du an den Anfangspunkt zurückgebracht.",
                                                    (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_ORANGE);
                e.CurrentCharacter.Position = Constants.DefaultSpawnPosition.ToJson();
                e.CurrentCharacter.Rotation = Constants.DefaultSpawnRotation;
                return;
            }
            AntiCheatController.TeleportPlayer(client, e.CurrentCharacter.Position.FromJson <Vector3>(), new Vector3(0, 0, e.CurrentCharacter.Rotation));
            client.Account().IsSpawned = true;
            client.BlockInteractionKeys(false);
            DimensionManager.GoToNormalWorldDimension(client);
            InteractionController.UpdateInteractableObjectsForPlayer(client);
            if (client.Account().AdminLevel == AdminLevel.AdminLevel4)
            {
                client.AdminMode(true);
                API.sendColoredNotificationToPlayer(client, "AdminMode aktiviert", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_BLUE);
            }
        }
Exemplo n.º 2
0
 public static void LeavCharacterEditor(Client client)
 {
     client.triggerEvent("DestroyCamera");
     client.Account().IsInEditor = false;
     client.DisplayRadar(true);
     client.Account().CurrentCharacter.ClothingString = null;
     client.Account().CurrentCharacter.ClothingStringToClothing();
     OnPlayerFinishedCharacterEditor?.Invoke(client, client.Account());
 }
 private void API_onPlayerDisconnected(Client player, string reason)
 {
     if (player.IsLoggedIn())
     {
         if (player.Account() == null)
         {
             return;
         }
         if (player.Account().CurrentCharacter == null)
         {
             return;
         }
         CharacterController.SaveCharacter(player, player.Account().CurrentCharacter);
         AccountController.LogoutPlayer(player);
     }
 }
Exemplo n.º 4
0
        public static void SetCreatorClothes(Client player, int gender)
        {
            // clothes
            player.setDefaultClothes();
            for (int i = 0; i < 10; i++)
            {
                player.clearAccessory(i);
            }

            if (gender == 0)                  // Mann
            {
                player.setClothes(3, 15, 0);  // Torso
                player.setClothes(4, 21, 0);  // Hose
                player.setClothes(6, 34, 0);  // Schuhe
                player.setClothes(8, 15, 0);  // Unterhemd
                player.setClothes(11, 15, 0); // Oberteil
            }
            else // Frau
            {
                player.setClothes(3, 15, 0);  // Torso
                player.setClothes(4, 10, 0);  // Hose
                player.setClothes(6, 35, 0);  // Schuhe
                player.setClothes(8, 15, 0);  // Unterhemd
                player.setClothes(11, 15, 0); // Oberteil
            }

            player.setClothes(2, player.Account().CurrentCharacter.CharacterStyle.Hair.Hair, 0);
        }
Exemplo n.º 5
0
        public void AdminAddGarage(Client client, string garageName)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            var acc = client.Account();

            if ((int)acc.AdminLevel < 5)
            {
                return;
            }
            Garage garage = new Garage();

            garage.Position    = client.position.ToJson();
            garage.PedPosition = garage.Position;
            garage.PedRotation = client.rotation.Z;
            garage.Name        = garageName;
            using (var db = new Database())
            {
                db.Garages.Add(garage);
                db.SaveChanges();
                API.sendNotificationToPlayer(client, $"Garage mit der ID: {garage.Id} wurde hinzugefügt.");
            }
        }
Exemplo n.º 6
0
        public void AdminAddGarageSpawn(Client client, int garageId)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            var acc = client.Account();

            if ((int)acc.AdminLevel < 5)
            {
                return;
            }
            using (var db = new Database())
            {
                Garage garage = db.Garages.FirstOrDefault(x => x.Id == garageId);
                if (garage == null)
                {
                    API.sendNotificationToPlayer(client, $"Die Gargae mit der ID: {garageId} wurde nicht gefunden.");
                    return;
                }
                garage.SpotStringsToSpots();
                garage.ParkOutSpots.Add(new GarageParkOutSpot
                {
                    BigVehicleAllowed = true,
                    Position          = client.position,
                    Rotation          = client.rotation,
                    Radius            = 6f
                });
                garage.SpotsToSpotStrings();
                db.SaveChanges();
                API.sendNotificationToPlayer(client, $"Ausparkpunkt wurde zur Garage(ID: {garageId}) hinzugefügt.");
            }
        }
        public static void GiveUnemploymentBenefits(Client client)
        {
            int accountnumber = GetCharacterBankAccount(client);

            if (accountnumber == 0)
            {
                return;
            }
            using (var db = new Database())
            {
                BankAccount bankAccount = db.BankAccounts.FirstOrDefault(acc => acc.AccountNumber == accountnumber);
                if (bankAccount == null)
                {
                    return;
                }
                bankAccount.Money += Constants.UnemploymentBenefits;
                bankAccount.StringToHistory();
                bankAccount.History.Add(new BankAccountHistory
                {
                    Amount   = Constants.UnemploymentBenefits,
                    Date     = DateTime.Now,
                    IssuedBy = 0,
                    Target   = client.Account().CurrentCharacter.Id,
                    Type     = BankAccountHistoryType.UnemploymentBenefits,
                    Position = client.position
                });
                bankAccount.HistoryToString();
                db.SaveChangesAsync();
            }
            client.sendColoredNotification($"Du hast {Constants.UnemploymentBenefits} $ Arbeitslosengeld bekommen.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_BLUE);
        }
Exemplo n.º 8
0
 void licgiv(Client player)
 {
     if (player.IsLoggedIn())
     {
         player.Account().GiveLicense(1);
         player.SendChatMessage("daj licencje 1");
     }
 }
Exemplo n.º 9
0
        public static void LogoutPlayer(Client client)
        {
            var account = client.Account();

            SaveAccount(client);
            account.CurrentCharacter = null;
            account.CurrentClient    = null;
        }
 public static bool HasPlayerVehicleKey(this Client client, int vehicleId)
 {
     if (!client.IsLoggedIn())
     {
         return(false);
     }
     return(client.Account().CurrentCharacter.KeyRing.VehicleKeys.ContainsKey(vehicleId));
 }
Exemplo n.º 11
0
 void liccheck(Client player)
 {
     if (player.IsLoggedIn())
     {
         bool has = player.Account().HasLicense(1);
         player.SendChatMessage("ma licencje 1? {0}", has);
     }
 }
        public static void Withdraw(Client client, double amount, bool allowNegativeBankValue = false)
        {
            int accountnumber = client.GetData("OPEN_ATM_ACCOUNT_NUMBER", 0);

            if (accountnumber == 0)
            {
                return;
            }
            BankAccount account = null;

            using (var db = new Database())
            {
                account = db.BankAccounts.FirstOrDefault(acc => acc.AccountNumber == accountnumber);
                if (account == null)
                {
                    return;
                }
                if (account.Money < amount && !allowNegativeBankValue)
                {
                    GameMode.sharedAPI.sendColoredNotificationToPlayer(client, "Es befindet sich nicht genug Geld auf dem Konto!", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
                    return;
                }

                client.Account().CurrentCharacter.Cash += amount;
                CharacterController.SaveCharacter(client, client.Account().CurrentCharacter);

                account.Money -= amount;
                account.StringToHistory();
                account.History.Add(new BankAccountHistory
                {
                    Amount   = (amount - (2 * amount)),
                    Date     = DateTime.Now,
                    IssuedBy = client.Account().CurrentCharacter.Id,
                    Target   = account.AccountNumber,
                    Type     = BankAccountHistoryType.Withdraw,
                    Position = client.position
                });
                account.HistoryToString();
                db.SaveChanges();
                UpdateAtmDisplay(client);

                GameMode.sharedAPI.sendColoredNotificationToPlayer(client, $"Du hast erfolgreich {amount} $ von {account.AccountNumber} abgehoben.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
            }
        }
        public static void Deposit(Client client, double amount)
        {
            int accountnumber = client.GetData("OPEN_ATM_ACCOUNT_NUMBER", 0);

            if (accountnumber == 0)
            {
                return;
            }
            BankAccount account = null;

            using (var db = new Database())
            {
                account = db.BankAccounts.FirstOrDefault(acc => acc.AccountNumber == accountnumber);
                if (account == null)
                {
                    return;
                }
                if (client.Account().CurrentCharacter.Cash < amount)
                {
                    GameMode.sharedAPI.sendColoredNotificationToPlayer(client, "Du hast nicht so viel Geld dabei!", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
                    return;
                }

                client.Account().CurrentCharacter.Cash -= amount;
                CharacterController.SaveCharacter(client, client.Account().CurrentCharacter);

                account.Money += amount;
                account.StringToHistory();
                account.History.Add(new BankAccountHistory
                {
                    Amount   = amount,
                    Date     = DateTime.Now,
                    IssuedBy = client.Account().CurrentCharacter.Id,
                    Target   = client.Account().CurrentCharacter.Id,
                    Type     = BankAccountHistoryType.Deposit,
                    Position = client.position
                });
                account.HistoryToString();
                db.SaveChanges();
                UpdateAtmDisplay(client);

                GameMode.sharedAPI.sendColoredNotificationToPlayer(client, $"Du hast erfolgreich {amount} $ auf {account.AccountNumber} eingezahlt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
            }
        }
        private void MenuController_OnPlayerMenuSelectEvent(Client client, MenuEventData data)
        {
            if (!client.IsLoggedIn() || (int)client.Account().AdminLevel < 1)
            {
                client.sendNotification("", "~r~Keine Berechtigung!");
                return;
            }
            if (data.MenuIdentifier == "vehicle_interaction" && data.EventTrigger == "admin_main")
            {
                OpenVehicleAdminMenu(client, data);
                return;
            }
            if (data.MenuIdentifier == "vehicle_interaction_admin")
            {
                OwnedVehicle vehicle = OwnedVehicleController.ExistingVehicles.FirstOrDefault(x => x.Handle.Value == data.EventInt);
                if (vehicle == null)
                {
                    MenuController.CloseAllMenus(client);
                    return;
                }
                switch (data.EventTrigger)
                {
                case "admin_park_vehicle":
                    OwnedVehicleController.ParkVehicle(vehicle);
                    MenuController.CloseAllMenus(client);
                    client.sendColoredNotification($"Das Fahrzeug(ID: {vehicle.Id}) wurde erfolgreich eingeparkt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
                    break;

                case "admin_create_vehicle_key":
                    if (client.Account().CurrentCharacter.KeyRing.VehicleKeys.ContainsKey(vehicle.Id))
                    {
                        client.Account().CurrentCharacter.KeyRing.VehicleKeys[vehicle.Id].Count++;
                    }
                    else
                    {
                        client.Account().CurrentCharacter.KeyRing.VehicleKeys.Add(vehicle.Id, new KeyData(1, $"{vehicle.ModelName} ({vehicle.NumberPlate})"));
                    }
                    client.sendColoredNotification($"Es wurde erfolgreich ein Schlüssel für das Fahrzeug(ID: {vehicle.Id}) erstellt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
                    MenuController.CloseAllMenus(client);
                    break;
                }
            }
        }
 public static void ApplyCharacterToSession(Client player, int characterId)
 {
     if (player.Account() == null)
     {
         return;
     }
     using (var db = new Database())
     {
         var chr = db.Characters.FirstOrDefault(ch => ch.Id == characterId);
         player.Account().CurrentCharacter = chr;
         player.health = chr.Health;
         player.armor  = chr.Armor;
         chr.StyleStringToStyle();
         chr.ClothingStringToClothing();
         chr.StringToBankAccountAccess();
         chr.StringToData();
         OnPlayerSelectCharacter?.Invoke(player, player.Account());
     }
 }
 public static void SaveCharacter(Client client, Character character, bool includeGeneralData = false)
 {
     character.LastActivity = DateTime.Now;
     if (!client.Account().IsInEditor&& client.Account().IsSpawned)
     {
         character.Position = client.position.ToJson();
         character.Rotation = client.rotation.Z;
     }
     character.StyleToStyleString();
     character.ClothingToClothingString();
     character.BankAccountAccessToString();
     character.DataToString();
     using (var db = new Database())
     {
         var ch = db.Characters.FirstOrDefault(x => x.Id == character.Id);
         if (ch == null)
         {
             return;
         }
         //db.Entry(ch).CurrentValues.SetValues(account.CurrentCharacter); Overwrite All Values
         ch.LastActivity            = character.LastActivity;
         ch.Position                = character.Position;
         ch.Rotation                = character.Rotation;
         ch.Hunger                  = character.Hunger;
         ch.Thirst                  = character.Thirst;
         ch.Health                  = character.Health;
         ch.Armor                   = character.Armor;
         ch.Cash                    = character.Cash;
         ch.CharacterStyleString    = character.CharacterStyleString;
         ch.ClothingString          = character.ClothingString;
         ch.BankAccountAccessString = character.BankAccountAccessString;
         ch.SalaryTime              = character.SalaryTime;
         ch.TotalPlayTime           = character.TotalPlayTime;
         ch.KeyRingString           = character.KeyRingString;
         if (includeGeneralData)
         {
             ch.FirstName = character.FirstName;
             ch.LastName  = character.LastName;
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 17
0
        public static void SetDefaultFeatures(Client player, int gender, bool reset = false)
        {
            if (reset)
            {
                var chstyle = player.Account().CurrentCharacter.CharacterStyle;
                chstyle        = new CharacterStyle();
                chstyle.Gender = gender;

                chstyle.Parents.Father         = 0;
                chstyle.Parents.Mother         = 21;
                chstyle.Parents.Similarity     = (gender == 0) ? 1.0f : 0.0f;
                chstyle.Parents.SkinSimilarity = (gender == 0) ? 1.0f : 0.0f;
            }

            // will apply the resetted data
            ApplyCharacterStyle(player, player.Account().CurrentCharacter);

            // clothes
            SetCreatorClothes(player, gender);
        }
 private void AddVehicleInteractionMenu(Client client, Menu menu)
 {
     if (!client.IsLoggedIn() || (int)client.Account().AdminLevel < 1)
     {
         return;
     }
     menu.Items.Add(new MenuItem("~r~Admin")
     {
         EventInt = menu.ExtraInt, EventTrigger = "admin_main"
     });
 }
Exemplo n.º 19
0
 void setmoney(Client player, long amount)
 {
     if (player.IsLoggedIn())
     {
         player.SendChatMessage("Ustaw {0} $", amount);
         player.Account().SetMoney(amount, "komenda /setmoney");
     }
     else
     {
         player.SendChatMessage("musisz być zalogowany");
     }
 }
Exemplo n.º 20
0
        public static void OpenCharacterEditorForPlayer(Client client, bool editExistCharacter = true)
        {
            client.Account().IsInEditor = true;
            client.triggerEvent("CreatorPrepare");
            GameMode.sharedAPI.delay(400, true, () =>
            {
                AntiCheatController.TeleportPlayer(client, Constants.CharacterEditorCharPos, new Vector3(0f, 0f, Constants.CharacterEditorCharFacingAngle));
                client.DisplayRadar(false);
                DimensionManager.RequestPrivateDimension(client);
                if (editExistCharacter)
                {
                    SetCreatorClothes(client, client.Account().CurrentCharacter.CharacterStyle.Gender);
                    client.triggerEvent("UpdateCreator", GameMode.sharedAPI.toJson(client.Account().CurrentCharacter.CharacterStyle), client.Account().CurrentCharacter.FirstName,
                                        client.Account().CurrentCharacter.LastName);
                }
                else
                {
                    SetDefaultFeatures(client, 0);
                }

                client.triggerEvent("CreatorCamera", Constants.CharacterEditorCameraPos, Constants.CharacterEditorCameraLookAtPos, Constants.CharacterEditorCharFacingAngle);
            });
        }
Exemplo n.º 21
0
        private void ClientSideSetGender(Client client, string eventName, object[] arguments)
        {
            if (arguments.Length < 1)
            {
                return;
            }

            int gender = Convert.ToInt32(arguments[0]);

            client.setSkin((gender == 0) ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01);
            client.Account().CurrentCharacter.CharacterStyle.Gender = gender;
            client.setData("ChangedGender", true);
            SetDefaultFeatures(client, gender, true);
        }
        public static void ApplyCharacterClothing(Client client)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            if (client.Account().CurrentCharacter == null)
            {
                sharedLogger.Debug($"Applied Clothing to {client.socialClubName} failed character is Null");
                return;
            }
            var style = client.Account().CurrentCharacter.Clothing;

            if (style == null)
            {
                sharedLogger.Debug($"Applied Clothing to {client.socialClubName} failed style is Null");
                return;
            }
            client.setClothes(0, style.Mask.Drawable, style.Mask.Texture);
            client.setClothes(3, style.Top.Torso.Drawable, style.Top.Torso.Texture);
            client.setClothes(8, style.Top.Undershirt.Drawable, style.Top.Undershirt.Texture);
            client.setClothes(11, style.Top.Top.Drawable, style.Top.Top.Texture);
            client.setClothes(4, style.Leg.Drawable, style.Leg.Texture);
            client.setClothes(6, style.Feet.Drawable, style.Feet.Texture);
            client.setClothes(9, style.Vest.Drawable, style.Vest.Texture);
            client.setClothes(5, style.Bag.Drawable, style.Bag.Texture);
            client.setClothes(10, style.Decal.Drawable, style.Decal.Texture);
            client.setClothes(7, style.Accessories.Drawable, style.Accessories.Texture);

            client.setAccessories(0, style.Hat.Drawable, style.Hat.Texture);
            client.setAccessories(1, style.Glasses.Drawable, style.Glasses.Texture);
            client.setAccessories(2, style.Ears.Drawable, style.Ears.Texture);
            client.setAccessories(6, style.Watches.Drawable, style.Watches.Texture);
            client.setAccessories(7, style.Bracelets.Drawable, style.Bracelets.Texture);
            sharedLogger.Debug($"Applied Clothing to {client.socialClubName}");
        }
Exemplo n.º 23
0
        public void AdminAddVehicleKey(Client client, int vehicleId)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            var acc = client.Account();

            if ((int)acc.AdminLevel < 5)
            {
                return;
            }
            acc.CurrentCharacter.KeyRing.VehicleKeys.Add(vehicleId, new KeyData(1, "Admin Key Veh: " + vehicleId));
            API.sendNotificationToPlayer(client, $"Schlüsself für die Fahrzeug ID: {vehicleId} wurde zum Schlüsselbund hinzugefügt.");
        }
Exemplo n.º 24
0
        public void AdminAllowReCreateCharacter(Client client, Client targetPlayer)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            var acc = client.Account();

            if ((int)acc.AdminLevel < 5)
            {
                return;
            }
            CharacterEditorController.OpenCharacterEditorForPlayer(targetPlayer, true);
            API.sendColoredNotificationToPlayer(client, $"{targetPlayer.socialClubName} darf nun seinen Charakter überarbeiten",
                                                (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
        }
Exemplo n.º 25
0
        private void OpenVehicleKeyOverviewForPlayer(Client client)
        {
            Menu menu = new Menu("Fahrzeugschlüssel", "Vefügbare Optionen:", "inventory");

            foreach (var key in client.Account().CurrentCharacter.KeyRing.VehicleKeys)
            {
                menu.Items.Add(new MenuItem(key.Value.Label, "", $"{key.Value.Count}x", true, "show_vehicle_key_options", key.Value.Label, key.Key));
            }
            if (menu.Items.Count == 0)
            {
                menu.Items.Add(new MenuItem("Keine Schlüssel vorhanden")
                {
                    EventTrigger = "key_overview"
                });
            }
            menu.Show(client);
        }
Exemplo n.º 26
0
 private void CharacterController_OnPlayerSelectCharacter(Client client, Account e)
 {
     if (e.CurrentCharacter.CharacterStyleString == null || e.CurrentCharacter.CharacterStyleString == "")
     {
         API.delay(100, true, () =>
         {
             OpenCharacterEditorForPlayer(client, false);
             client.FadeScreenIn(1000);
         });
         return;
     }
     ApplyCharacterStyle(client, e.CurrentCharacter);
     API.delay(1000, true, () =>
     {
         client.FadeScreenIn(1000);
         OnPlayerFinishedCharacterEditor?.Invoke(client, client.Account());
     });
 }
Exemplo n.º 27
0
        public static void SaveAccount(Client client)
        {
            if (!client.IsLoggedIn())
            {
                return;
            }
            var account = client.Account();

            using (var db = new Database())
            {
                var acc = db.Accounts.FirstOrDefault(x => x.Id == account.Id);
                acc.LastActivity = DateTime.Now;
                acc.HardwareID   = client.uniqueHardwareId;
                acc.Ip           = client.address;
                acc.IsLoggedIn   = false;
                db.SaveChanges();
            }
        }
        public static int GetCharacterBankAccount(Client client)
        {
            int charid = client.Account().CurrentCharacter.Id;

            using (var db = new Database())
            {
                if (db.BankAccounts.Count() == 0)
                {
                    return(0);
                }
                var account = db.BankAccounts.FirstOrDefault(x => x.OwnerUser == charid && x.IsPrivate);
                if (account == null)
                {
                    return(CreateBankAccount(Constants.BankAccountStartMoney, charid, true));
                }
                return(account.AccountNumber);
            }
        }
Exemplo n.º 29
0
 public static void LoginPlayer(Client client, Account account)
 {
     account.CurrentClient = client;
     account.LastActivity  = DateTime.Now;
     account.IsLoggedIn    = true;
     client.Account(account);
     client.IsLoggedIn(true);
     client.FadeScreenOut(200);
     using (var db = new Database())
     {
         var acc = db.Accounts.First(x => x.Id == account.Id);
         acc.IsLoggedIn   = true;
         acc.LastActivity = DateTime.Now;
         acc.Ip           = client.address;
         acc.HardwareID   = client.uniqueHardwareId;
         db.SaveChangesAsync();
     }
     GameMode.sharedAPI.delay(220, true, () =>
     {
         OnPlayerSuccessfulLoggedIn?.Invoke(client, account);
     });
 }
Exemplo n.º 30
0
        private void ParkOutGarageEvent(Client client, string eventName, object[] arguments)
        {
            Character ch     = client.Account().CurrentCharacter;
            var       garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 1f);

            if (garage == null)
            {
                return;
            }
            List <GarageVehicleList> list     = new List <GarageVehicleList>();
            List <OwnedVehicle>      vehicles = new List <OwnedVehicle>();

            using (var db = new Database())
            {
                vehicles = db.OwnedVehicles.Where(x => ch.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) && x.InGarage && x.CanParkOutEverywhere ||
                                                  ch.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) && !x.CanParkOutEverywhere && garage.Id == x.LastGarageId).ToList();
            }

            foreach (OwnedVehicle vehicle in vehicles)
            {
                list.Add(new GarageVehicleList
                {
                    Id    = vehicle.Id.ToString(),
                    Title = vehicle.ModelName
                });
            }

            if (list.Count == 0)
            {
                list.Add(new GarageVehicleList
                {
                    Id    = "0",
                    Title = "Es wurden keine Fahrzeuge gefunden.."
                });
            }
            client.triggerEvent("showBrowser", Constants.GarageParkOutListUrl, "FillWindow", JsonConvert.SerializeObject(list));
        }