Beispiel #1
0
        private void ParkOutVehicleEvent(Client client, string eventName, object[] arguments)
        {
            CloseWindow(client);
            int id     = Convert.ToInt32(arguments[0]);
            var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 2f);

            if (garage == null)
            {
                return;
            }
            GarageParkOutSpot foundSpot = null;

            foreach (GarageParkOutSpot spot in garage.ParkOutSpots)
            {
                if (OwnedVehicleController.IsAnyVehicleBlockingThisArea(spot.Position, spot.Radius))
                {
                    continue;
                }
                else
                {
                    foundSpot = spot;
                    break;
                }
            }
            if (foundSpot != null)
            {
                OwnedVehicleController.ParkOutVehicle(id, foundSpot.Position, foundSpot.Rotation);
                client.sendColoredNotification("Das Fahrzeug wurde erfolgreich ausgeparkt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
            }
            else
            {
                client.sendColoredNotification("Es wurde kein freier Parkplatz gefunden..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
            }
        }
Beispiel #2
0
        private void ParkInGarageEvent(Client client, string eventName, object[] arguments)
        {
            CloseWindow(client);
            var garage = Garages.FirstOrDefault(x => x.Position.FromJson <Vector3>().DistanceTo(client.position) <= 2f);

            if (garage == null)
            {
                client.sendColoredNotification("Du bist zu weit von einer Garage entfernt..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
                return;
            }
            if (garage.ParkOutSpots.Count == 0)
            {
                client.sendColoredNotification($"Es wurde kein Ausparkpunkt gefunden.. Melde dies einem Admin ({garage.Id})", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
                return;
            }
            OwnedVehicle vehicle = OwnedVehicleController.ExistingVehicles.FirstOrDefault(x => client.Account().CurrentCharacter.KeyRing.VehicleKeys.Keys.ToList().Contains(x.Id) &&
                                                                                          x.Handle.position.DistanceTo(garage.ParkInSpots[0].Position) <= garage.ParkInSpots[0].Radius);

            if (vehicle == null)
            {
                client.sendColoredNotification("Es wurde kein einparkbares Fahrzeug gefunden..", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_RED);
                return;
            }
            OwnedVehicleController.ParkVehicle(vehicle, garage.Id, false);
            client.sendColoredNotification("Das Fahrzeug wurde erfolgreich eingeparkt.", (int)HudColor.HUD_COLOUR_PURE_WHITE, (int)HudColor.HUD_COLOUR_GREEN);
        }