Beispiel #1
0
        public void StartEntry(int entryPoint, Ped[] team)
        {
            float heading = 0f;

            switch (entryPoint)
            {
            case 0:     // Water
                var entryPos = new Vector3(3098.805f, -4801.487f, 2.037071f);
                heading = 14.18145f;
                Ped lastped = new Ped(0);
                for (int index = 0; index < team.Length; index++)
                {
                    team[index].Position = entryPos;
                    if (lastped.Exists())
                    {
                        team[index].Position -= lastped.ForwardVector * 2;
                    }
                    team[index].Heading = heading;
                    lastped             = team[index];
                }
                var enforcermodel = new Model(VehicleHash.Dinghy2);
                enforcermodel.Request(10);
                var enforcer = World.CreateVehicle(enforcermodel, new Vector3(3094.513f, -4802.502f, 0.1324978f), 15.62522f);
                CleanupBag.Add(enforcer);
                EntryComplete = true;
                break;

            case 1:     // Plane
                planeEntry = new PlaneEntry(new Vector3(-1598.288f, -2992.517f, 14.87434f), 241.2218f, new Vector3(2541.847f, -3829.26f, 115.3642f),
                                            new Vector3(3002.718f, -4602.471f, 15.26161f), new Vector3(3049.975f, -4704.251f, 15.25679f));
                foreach (Ped ped in team)
                {
                    planeEntry.AddPassenger(ped);
                }
                planeEntry.Start();
                break;

            case 2:     // Rappel
                Vector3[] rappelpads = new[]
                {
                    new Vector3(-1114.415f, -2884.573f, 14.04894f),
                    new Vector3(-1145.432f, -2864.025f, 14.05568f),
                };
                for (int i = 0; i < Convert.ToInt32(team.Length / 2); i++)
                {
                    var rappel = new RappelEntry(rappelpads[i], new Vector3(3079.936f, -4649.66f, 23.87023f));
                    var team2  = team.Reverse().ToList();
                    for (int d = 0 + (2 * i); d < 2 + (2 * i); d++)
                    {
                        Ped t = team2[d];
                        rappel.AddPassenger(t);
                    }
                    rappelUpdates.Add(rappel);
                }
                break;
            }
        }
Beispiel #2
0
 public void StartEntry(int entryPoint, Ped[] team)
 {
     float heading = 0f;
     switch (entryPoint)
     {
         case 0: // Water
             var entryPos = new Vector3(3098.805f, -4801.487f, 2.037071f);
             heading = 14.18145f;
             Ped lastped = new Ped(0);
             for (int index = 0; index < team.Length; index++)
             {
                 team[index].Position = entryPos;
                 if (lastped.Exists()) team[index].Position -= lastped.ForwardVector*2;
                 team[index].Heading = heading;
                 lastped = team[index];
             }
             var enforcermodel = new Model(VehicleHash.Dinghy2);
             enforcermodel.Request(10);
             var enforcer = World.CreateVehicle(enforcermodel, new Vector3(3094.513f, -4802.502f, 0.1324978f), 15.62522f);
             CleanupBag.Add(enforcer);
             EntryComplete = true;
             break;
         case 1: // Plane
             planeEntry = new PlaneEntry(new Vector3(-1598.288f, -2992.517f, 14.87434f), 241.2218f, new Vector3(2541.847f, -3829.26f, 115.3642f),
                 new Vector3(3002.718f, -4602.471f, 15.26161f), new Vector3(3049.975f, -4704.251f, 15.25679f));
             foreach (Ped ped in team)
             {
                 planeEntry.AddPassenger(ped);
             }
             planeEntry.Start();
             break;
         case 2: // Rappel
             Vector3[] rappelpads = new[]
             {
                 new Vector3(-1114.415f, -2884.573f, 14.04894f),
                 new Vector3(-1145.432f, -2864.025f, 14.05568f),
             };
             for (int i = 0; i < Convert.ToInt32(team.Length/2); i++)
             {
                 var rappel = new RappelEntry(rappelpads[i], new Vector3(3079.936f, -4649.66f, 23.87023f));
                 var team2 = team.Reverse().ToList();
                 for (int d = 0 + (2*i); d < 2 + (2*i); d++)
                 {
                     Ped t = team2[d];
                     rappel.AddPassenger(t);
                 }
                 rappelUpdates.Add(rappel);
             }
             break;
     }
 }
Beispiel #3
0
 public void StartEntry(int entryPoint, Ped[] team)
 {
     var entry = _entryData[entryPoint];
     switch (entry.Type)
     {
         case EntryTypes.Teleport:
             foreach (var ped in team)
             {
                 ped.Position = entry.Position;
                 ped.Heading = entry.Heading;
             }
             break;
         case EntryTypes.Rappel:
             if (team.Length == 1)
             {
                 var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                 rappel.AddPassenger(team[0]);
                 _rappelUpdates.Add(rappel);
             }
             else
             {
                 var rappel = new RappelEntry(entry.Helipads[0], entry.Position);
                 foreach (Ped ped in team)
                 {
                     rappel.AddPassenger(ped);
                 }
                 _rappelUpdates.Add(rappel);
             }
             break;
         case EntryTypes.Plane:
             _planeEntry = new PlaneEntry(entry.PlaneSpawn, entry.PlaneSpawnHeading, entry.Approach, entry.RunwayStart, entry.RunwayEnd);
             foreach (Ped ped in team)
             {
                 _planeEntry.AddPassenger(ped);
             }
             _planeEntry.Start();
             break;
     }
     foreach (var source in _decorativeVehicles.Where(x => x.EntryPoint == entryPoint))
     {
         var tmpMod = new Model(source.Model);
         int counter = 0;
         do
         {
             tmpMod.Request();
             Script.Yield();
             counter++;
         } while (!tmpMod.IsLoaded && counter < 10000);
         var tmpVeh = Function.Call<Vehicle>(Hash.CREATE_VEHICLE, tmpMod.Hash, source.Position.X, source.Position.Y, source.Position.Z,source.Heading, false, false);
         tmpVeh.SirenActive = source.SirenActive;
         foreach (VehicleDoor door in source.OpenDoors)
         {
             tmpVeh.OpenDoor(door, false, false);
         }
         CleanupBag.Add(tmpVeh);
     }
 }