public static void CreateDeloreonintruck(Vector3 truckposition)
        {
            if (!(Docstruck == null))
            {
                Docstruck.Delete();
            }
            Model gmcvan = new Model("GMCVAN");
            if (gmcvan.IsValid)
            {
                Docstruck = World.CreateVehicle(gmcvan, truckposition);
                Docstruck.Rotation = new Vector3(0, 0, 102);
                Docstruck.OpenDoor(VehicleDoor.Trunk, false, true);

                Vector3 position = Docstruck.GetOffsetInWorldCoords(new Vector3(0, -10, 0));

                TimeTravel.instantDelorean.Deloreanlist.Add(new TimeCircuits());
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon = World.CreateVehicle(new Model("BTTF"), position);
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.Rotation = new Vector3(0, 0, 102);
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.IsInvincible = true;
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.CanBeVisiblyDamaged = false;
                if (!(Doc == null))
                {
                    Doc.Delete();
                }
                Doc = TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.CreatePedOnSeat(VehicleSeat.Driver, new Model("S_M_M_Doctor_01"));
                Doc.RelationshipGroup = (int)Relationship.Companion;

                Einstein = World.CreatePed(PedHash.Chop, Docstruck.GetOffsetInWorldCoords(new Vector3(-20, 0, 0)));
                Einstein.RelationshipGroup = (int)Relationship.Companion;
                Einstein.IsInvincible = true;

                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.DirtLevel = 0;
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.PrimaryColor = VehicleColor.BrushedAluminium;
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.SecondaryColor = VehicleColor.BrushedAluminium;
                TimeTravel.instantDelorean.Deloreanlist[TimeTravel.instantDelorean.Deloreanlist.Count - 1].Deloreon.NumberPlate = "OutATime";
            }
        }
 private void OpenVehicleHood( Vehicle vehicle, bool state = true )
 {
     if ( state )
     {
         vehicle.OpenDoor( VehicleDoor.Hood, false, false );
     }
     else
     {
         vehicle.CloseDoor( VehicleDoor.Hood, false );
     }
 }
Esempio n. 3
0
        public void OnStartMission(Gamemodes gamemode)
        {
            Gamemode = gamemode;
            LoadIPL();
            foreach (var veh in _decorativeVehicles.Where(x => x.EntryPoint == -1))
            {
                var tmpMod = new Model(veh.Model);
                int counter = 0;
                do
                {
                    tmpMod.Request();
                    counter++;
                    Script.Yield();
                } while (!tmpMod.IsLoaded && counter < 10000);
                if(counter >= 10000) continue;

                Vehicle tmpVeh = new Vehicle(Function.Call<int>(Hash.CREATE_VEHICLE, tmpMod.Hash, veh.Position.X, veh.Position.Y,veh.Position.Z, veh.Heading, false, false));
                tmpVeh.SirenActive = veh.SirenActive;
                foreach (VehicleDoor door in veh.OpenDoors)
                {
                    tmpVeh.OpenDoor(door, false, false);
                }
                CleanupBag.Add(tmpVeh);
                }
            var tmpposs = new List<Tuple<Vector3, float>>(_positions);
            var tmpMax = _maxEnemies;
            if (_maxEnemies == -1) tmpMax = Enemy.Dice.Next(_positions.Count/2, _positions.Count);
            MaxEnemies = tmpMax;
            for(int i = 0; i < tmpMax; i++)
            {
                Enemy tmp;
                int ourPick = Enemy.Dice.Next(tmpposs.Count);
                Tuple<Vector3, float> ourTuple = tmpposs[ourPick];
                tmp = new Enemy(ourTuple.Item1, ourTuple.Item2);
                tmpposs.RemoveAt(ourPick);

                tmp.Character.Task.GuardCurrentPosition();
                BadGuys.Add(tmp);
                CleanupBag.Add(tmp.Character);
            }
            if (Gamemode == Gamemodes.BombDefusal)
            {
                BombDefused = false;
                _defusePercentage = 0;
                _defuseStart = null;
                IsDefusingBomb = false;

                var ourPick = _bombLocations[Enemy.Dice.Next(_bombLocations.Count)];
                CurrentBomb = new Tuple<Vector3, float>(ourPick.Item1, ourPick.Item2);
                int counter = 0;
                var barrelM = new Model(1298403575);
                do
                {
                    barrelM.Request();
                    counter++;
                    Script.Yield();
                } while (!barrelM.IsLoaded && counter < 2000);
                var barrel = World.CreateProp(barrelM, CurrentBomb.Item1 - new Vector3(0f, 0f, 1f), new Vector3(0f, 0f, CurrentBomb.Item2), false, false);
                barrel.FreezePosition = true;
                counter = 0;
                var bombM = new Model(929047740);
                do
                {
                    bombM.Request();
                    counter++;
                    Script.Yield();
                } while (!bombM.IsLoaded && counter < 2000);
                var bomb = World.CreateProp(bombM, CurrentBomb.Item1 - new Vector3(0f, 0f, 0.2f), new Vector3(-90f, 0f, CurrentBomb.Item2), false, false);
                bomb.FreezePosition = true;
                CleanupBag.Add(barrel);
                CleanupBag.Add(bomb);
            }
        }