public void preparePed(Ped ped) { if (ped.Exists()) { ped.Invincible = true; ped.WillFlyThroughWindscreen = false; ped.PreventRagdoll = true; } }
public List <Ped> ToList(bool includingLeader) { List <Ped> list = new List <Ped>(); if (includingLeader) { Ped leader = this.Leader; if ((leader != null) && leader.Exists()) { list.Add(leader); } } for (int i = 0; i < this.MemberCount; i++) { Ped member = this.GetMember(i); if ((member != null) && member.Exists()) { list.Add(member); } } return(list); }
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; } }
/// <summary> /// Determines whether the <see cref="Ped"/> exists. /// </summary> /// <param name="ped">The <see cref="Ped"/> to check.</param> /// <returns><c>true</c> if the <see cref="Ped"/> exists; otherwise, <c>false</c></returns> public static bool Exists(Ped ped) { return(!ReferenceEquals(ped, null) && ped.Exists()); }
private void Meteoat_Tick(object sender, EventArgs e) { if (rnd.Next(0, 100) < 1) { GC.Collect(); } if (AllF == true && Player.Character.isAlive) { // lc.CountDown(); T = (T + 17) % 360; if (Exists(A)) { A.Delete(); } //一回前の処理で作ったAさんを消す if (F_Probability >= 0) { Probability = F_Probability; MeteoInterval = 0; } else { if (--MeteoInterval < 0) { MeteoInterval = rnd.Next(25, 101); ProbabilityChangedTime = 50; if (Easy) { Probability = rnd.Next(0, 6) * 10; } else { Probability = rnd.Next(0, 11) * 10; } } } /* Random rnd2 = new Random(((int)Player.Character.Position.X / 80 + (int)Player.Character.Position.Y / 80) + seed + (GTA.World.CurrentDayTime.Minutes / 10)); //rnd2からその場所での降爆確率を求める if (Easy) { Probability = rnd2.Next(0, 51); } else { Probability = rnd2.Next(0, 101); } if (F_Probability >= 0) { Probability = F_Probability; } */ // 降爆確率を元にメテオを1つ降らすか決める if (rnd.Next(0, 101) > Probability) { return; } // Vector3 posit, playpos; // posit: Aさんの位置(メテオ落下位置) playpos:主人公の位置 Vector3 POS; // 落下エフェクト描画位置 playpos = Player.Character.Position; posit = playpos; posit = posit.Around(rnd.Next(150)); //Aさんの出現位置を150mでランダムに決める posit.Z = playpos.Z + 50.0f; //主人公より50m高い位置にAさんを配置する A = GTA.World.CreatePed(posit); //Aさん召喚 if (Exists(A)) { //Aさんの召喚に成功したなら if (IsMeteoOut() && A.Position.DistanceTo2D(Player.Character.Position) < 15.0f) { //メテオがそれる条件を満たしている時に近くにメテオが振りそうならAさんの位置をズラす A.Position = new Vector3(playpos.X + rnd.Next(20, 50), playpos.Y + rnd.Next(20, 50), 50); } POS = A.Position; POS.Z = playpos.Z; A.Visible = false; //Aさんの姿を透明にする float PlayerVelo = 0; if (Player.Character.isInVehicle()) { PlayerVelo = Player.Character.CurrentVehicle.Speed * 3; } //メテオ落下予定地点にエフェクトを描画 //車で移動している時は描画範囲を広げる if (Player.Character.Position.DistanceTo2D(POS) < 20.0f + PlayerVelo) { if (Player.Character.Position.Z - World.GetGroundZ(Player.Character.Position) > 2) { GTA.Native.Function.Call("TRIGGER_PTFX", "qub_lg_explode_red", POS.X, POS.Y, POS.Z, 0, 0, 0, 2.5f); } else { GTA.Native.Function.Call("TRIGGER_PTFX", "qub_lg_explode_red", POS.X, POS.Y, World.GetGroundZ(POS)+1.0f, 0, 0, 0, 2.5f); } // this.lc.AddLights(Color.Red, 10.0f, 15.0f, new Vector3(POS.X,POS.Y,World.GetGroundZ(POS)+1.0f), 5); } //発射シーケンス if (A.Exists()) { Vector3 Apos = A.Position; //RPGを装備させる A.Weapons.FromType(Weapon.Heavy_RocketLauncher).Ammo = 999; A.Weapons.Select(Weapon.Heavy_RocketLauncher); //真下に向かってRPGを発射させる GTA.Native.Function.Call("FIRE_PED_WEAPON", A, Apos.X, Apos.Y, Apos.Z - 50.0f); } } else { } } else { //メテオを切ったり、主人公が死んだ場合はAさんを削除 if (Exists(A)) { A.Delete(); } } if (!Player.Character.isAlive) { seed = rnd.Next(); } //死んだらrnd2の種をズラす }
public void StartEntry(int entryPoint, Ped[] team) { float heading = 0f; switch (entryPoint) { case 0: // Front var entryPos = new Vector3(-74.42314f, 6271.079f, 31.3722f); heading = 216.744f; for (int index = 0; index < team.Length; index++) { team[index].Position = entryPos; team[index].Heading = heading; } var enforcermodel = new Model(VehicleHash.Riot); enforcermodel.Request(10); var enforcer = World.CreateVehicle(enforcermodel, new Vector3(-79.03268f, 6277.942f, 31.11718f), 32.41939f); enforcer.SirenActive = true; enforcer.OpenDoor(VehicleDoor.BackLeftDoor, false, true); enforcer.OpenDoor(VehicleDoor.BackRightDoor, false, true); CleanupBag.Add(enforcer); var polmodel2 = new Model(VehicleHash.Police2); polmodel2.Request(10); var polcar = World.CreateVehicle(polmodel2, new Vector3(-83.34383f, 6274.731f, 30.95424f), 324.9319f); var polcar3 = World.CreateVehicle(polmodel2, new Vector3(-76.00045f, 6281.345f, 31.03065f), 270.7873f); polcar.SirenActive = true; polcar3.SirenActive = true; CleanupBag.Add(polcar); CleanupBag.Add(polcar3); EntryComplete = true; break; case 1: // Back var entryPosBack = new Vector3(-133.1731f, 6133.387f, 31.43232f); heading = 43.69439f; Ped lastpedback = new Ped(0); for (int index = 0; index < team.Length; index++) { team[index].Position = entryPosBack; if (lastpedback.Exists()) team[index].Position -= lastpedback.ForwardVector * 2; team[index].Heading = heading; lastpedback = team[index]; } var enforcermodelb = new Model(VehicleHash.Riot); enforcermodelb.Request(10); var enforcerb = World.CreateVehicle(enforcermodelb, new Vector3(-127.5568f, 6144.007f, 31.25361f), 335.7838f); enforcerb.SirenActive = true; enforcerb.OpenDoor(VehicleDoor.BackLeftDoor, false, true); enforcerb.OpenDoor(VehicleDoor.BackRightDoor, false, true); CleanupBag.Add(enforcerb); var polmodel = new Model(VehicleHash.Police2); polmodel.Request(10); var polcar1 = World.CreateVehicle(polmodel, new Vector3(-143.3609f, 6126.71f, 31.22926f), 252.053f); polcar1.SirenActive = true; CleanupBag.Add(polcar1); EntryComplete = true; break; case 2: // Back2 var entryPos2 = new Vector3(-182.2727f, 6166.434f, 31.35259f); heading = 221.0143f; for (int index = 0; index < team.Length; index++) { team[index].Position = entryPos2; team[index].Heading = heading; } var enforcermodel2 = new Model(VehicleHash.Riot); enforcermodel2.Request(10); var enforcer2 = World.CreateVehicle(enforcermodel2, new Vector3(-187.0582f, 6171.55f, 31.13244f), 43.85089f); enforcer2.SirenActive = true; enforcer2.OpenDoor(VehicleDoor.BackLeftDoor, false, true); enforcer2.OpenDoor(VehicleDoor.BackRightDoor, false, true); CleanupBag.Add(enforcer2); EntryComplete = true; break; } }
public void StartEntry(int entryPoint, Ped[] team) { float heading = 0f; switch (entryPoint) { case 0: // Front var entryPos = new Vector3(-1793.309f, -1196.424f, 12.017f); heading = 51.61f; 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.Riot); enforcermodel.Request(10); var enforcer = World.CreateVehicle(enforcermodel, new Vector3(-1794.152f, -1188.071f, 12.74f), 9.35f); enforcer.SirenActive = true; enforcer.OpenDoor(VehicleDoor.BackLeftDoor, false, true); enforcer.OpenDoor(VehicleDoor.BackRightDoor, false, true); CleanupBag.Add(enforcer); EntryComplete = true; break; case 1: // Water var model = new Model(VehicleHash.Predator); model.Request(10); var car = World.CreateVehicle(model, new Vector3(-1799.512f, -1230.37f, 0.568f), 139.47f ); CleanupBag.Add(car); entryPos = new Vector3(-1800.013f, -1227.414f, 1.66f); heading = 149.15f; foreach (Ped ped in team) { ped.Position = entryPos; ped.Heading = heading; } EntryComplete = true; break; case 2: // Rappel for (int i = 0; i < Convert.ToInt32(team.Length/2); i++) { var rappel = new RappelEntry(new Vector3(-1492.215f, -1230.166f, 2.87f).Around(20f), new Vector3(-1837.12f, -1254.43f, 20.18f)); 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; } }