Example #1
0
        private void SpawnTrailerRandomly()
        {
            var spawnPoint = Trailers.Shuffle().FirstOrDefault <SpawnPoint>(sp => sp.Type == SpawnPointTypes.Trailer && !AreVehiclesInRange(sp.Position, SpawnAreaClearanceRange));

            if (spawnPoint == null)
            {
                return;
            }

            var targetPoint = Destinations[_random.Next(0, Destinations.Count())];

            if (targetPoint == null)
            {
                return;
            }

            var trailerHash = _trailerHashes[_random.Next(0, _trailerHashes.Length)];
            int money       = new Random().Next(1000, 2000);
            var trailerInfo = new TrailerInfo(API.CreateVehicle(trailerHash, spawnPoint.Position, spawnPoint.Rotation.Z, new Color(0, 0, 0), new Color(0, 0, 0), "RageOS"), targetPoint.Position, money);

            //trailerInfo.Deleted += TrailerDeleted;
            //trailerInfo.EnteredDestination += TrailerEnteredDestination;
            //trailerInfo.DetachedOnDestination += TrailerDetachedOnDestination;

            _trailers.Add(trailerInfo);
        }
Example #2
0
        private void TrailerDetachedOnDestination(TruckInfo truckInfo, TrailerInfo trailerInfo)
        {
            API.ConsoleOutput("TrailerDetachedOnDestination");
            var driver = truckInfo.GetDriver();

            if (driver == null)
            {
                return;
            }
            if (driver.VehicleSeat != -1)
            {
                return;
            }
            double bankmoney = double.Parse(driver.GetData("Money").ToString());
            double cash      = bankmoney + trailerInfo.Money;

            driver.SetData("Money", cash);
            API.SendPictureNotificationToPlayer(driver, "Von: Spedition Perez \n Summe: $" + trailerInfo.Money.ToString() + " - \n Bargeld: $" + cash.ToString(), "CHAR_BANK_MAZE", 1, 1, "Spedition Perez", "Zahlungseingang");
            trailerInfo.Delete();
        }
Example #3
0
        private void TrailerEnteredDestination(TrailerInfo trailerInfo)
        {
            var driver = trailerInfo.GetTrailerDriver();

            API.SendNotificationToPlayer(driver, "Drücke H um den Anhänger abzukoppeln!");
        }
Example #4
0
 private void TrailerDeleted(TrailerInfo trailerInfo)
 {
     API.ConsoleOutput("TrailerDeleted");
     _trailers.Remove(trailerInfo);
 }