public override bool OnCalloutAccepted() { base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); this.blip = Functions.CreateBlipForArea(this.spawnPosition, 20f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; this.vehicle1 = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels)); if (this.vehicle1.Exists()) { // Ensure vehicle is freed on end Functions.AddToScriptDeletionList(this.vehicle1, this); this.vehicle1.PlaceOnNextStreetProperly(); this.vehicle1.AttachBlip(); this.vehicle1.EngineHealth = 50; driver = this.vehicle1.CreatePedOnSeat(VehicleSeat.Driver); Functions.SetPedIsOwnedByScript(driver, this, true); DelayedCaller.Call(delegate { driver.Task.CruiseWithVehicle(vehicle1, 20, true); }, this, 1000); DelayedCaller.Call(delegate { this.vehicle1.HazardLightsOn = true; this.vehicle1.EngineHealth = 0; }, this, 4000); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); } return(true); }
private void RepairFunction1(params object[] parameter) { Vehicle vehicle = parameter[0] as Vehicle; LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("amb@bridgecops"), "open_boot", 4.0f); GTA.Native.Function.Call("OPEN_CAR_DOOR", vehicle, 4); DelayedCaller.Call(RepairFunction2, this, 1500, vehicle); }
private void RepairFunction2(params object[] parameter) { Vehicle vehicle = parameter[0] as Vehicle; LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("misstaxidepot"), "workunderbonnet", 4.0f); vehicle.EngineHealth = 800; DelayedCaller.Call(RepairFunction3, this, 8000, vehicle); }
/// <summary> /// Player is close. /// </summary> private void PlayerIsClose() { if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(this.spawnPoint.Position) > 55) { return; } this.blip.Delete(); if (this.IsPrankCall) { DelayedCaller.Call( delegate { // Tell control it was a prank Functions.PlaySound("EMERG_PRANK_CALL", true, false); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END"), 5000); Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END_TW"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); this.End(); }, this, 10000); this.State = EShootoutState.Prank; } else { bool playerHasBeenSpotted = false; bool randomFight = Common.GetRandomBool(0, 300, 1); // Check whether player has been spotted foreach (LPed criminal in this.criminals) { if (criminal.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { if (criminal.HasSpottedPed(LPlayer.LocalPlayer.Ped, false)) { playerHasBeenSpotted = true; break; } } } // If player has been spotted if (playerHasBeenSpotted || randomFight) { this.State = EShootoutState.Fighting; this.Engage(); this.Player_Yell(); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_FIGHT_SUSPECTS"), 5000); } } }
private void PlayerOnScene() { if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(officer.Position) <= 3f) { if (Functions.IsKeyDown(System.Windows.Forms.Keys.E)) { LPlayer.LocalPlayer.Ped.Task.TurnTo(officer); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_in", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_loop", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_out", 4.0f); Functions.PrintHelp("The officer is injured but stable and will be dealt with soon, locate the suspect."); Vector3 LastKnown = new Vector3(); if (getawayCar.Exists()) { LastKnown = getawayCar.Position; } else { End(); } Functions.PrintText("The suspect is in a " + getawayCar.Color + " " + getawayCar.Name + ". A blip has been placed at their last known location.", 4000); if (officer.Exists()) { officer.NoLongerNeeded(); } if (copCar.Exists()) { copCar.NoLongerNeeded(); } if (blip.Exists()) { blip.Delete(); } LastKnownBlip = Functions.CreateBlipForArea(LastKnown, 40f); if (LastKnownBlip.Exists()) { LastKnownBlip.Display = BlipDisplay.ArrowAndMap; LastKnownBlip.RouteActive = true; } State = EPedState.PlayerSearching; }, this, 6000); }, this, 2000); }, this, 2000); } } }
/// <summary> /// Called when <see cref="ENetworkMessages.RequestBackup"/> has been received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="message">The message.</param> private void NeedBackupHandlerFunction(NetworkServer sender, ReceivedUserMessage message) { // Read position and get associated area. Vector3 position = message.ReadVector3(); string area = Functions.GetAreaStringFromPosition(position); // Display message and blip. Functions.PrintText(string.Format("Officer {0} requests backup at {1}", sender.SafeName, area), 5000); Blip areaBlip = Functions.CreateBlipForArea(position, 25f); // Cleanup. DelayedCaller.Call(parameter => areaBlip.Delete(), this, 10000); }
/// <summary> /// Starts fighting. /// </summary> private void Engage() { foreach (LPed criminal in this.criminals) { if (criminal.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { // Enable chase AI and extend sense range so suspects won't flee immediately but fight longer criminal.DisablePursuitAI = false; criminal.RangeToDetectEnemies = 80f * 4; criminal.StartKillingSpree(true); } } // Maybe add chance suspects can flee too? Functions.SetPursuitDontEnableCopBlips(this.pursuit, false); Functions.SetPursuitAllowWeaponsForSuspects(this.pursuit, true); Functions.SetPursuitForceSuspectsToFight(this.pursuit, true); // Update tasking (print message to text wall) and override maximum units and pursuit tactics if isNGDRequestingAssistance is true if (isNGDRequestingAssistance) { Functions.SetPursuitIsActiveDelayed(this.pursuit, 0, Common.GetRandomValue(1000, 3000)); Functions.SetPursuitTactics(this.pursuit, true); Functions.SetPursuitHelicopterTactics(this.pursuit, true); Functions.SetPursuitMaximumUnits(this.pursuit, 40, 40); DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_MISSION_UPDATE, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); }, this, 5000); } // If isNGDRequestingAssistance is false while isOfficerCalledIn is true, override maximum units and pursuit tactics but DO NOT update tasking else if (isOfficerCalledIn && !isNGDRequestingAssistance) { Functions.SetPursuitIsActiveDelayed(this.pursuit, 0, Common.GetRandomValue(1000, 5000)); Functions.SetPursuitTactics(this.pursuit, true); Functions.SetPursuitHelicopterTactics(this.pursuit, true); Functions.SetPursuitMaximumUnits(this.pursuit, 40, 40); } // Otherwise set pursuit as active and delayed between 2500ms and 5000ms else { Functions.SetPursuitIsActiveDelayed(this.pursuit, 2500, 5000); } }
private void CallbackFunction() { if (LPlayer.LocalPlayer.Ped.IsInVehicle()) { LPlayer.LocalPlayer.LastVehicle.Speed = 0; Game.FadeScreenOut(1000); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.LastVehicle.Repair(); Functions.PrintText("Vehicle Repaired!", 2000); Game.FadeScreenIn(1000); }, this, 2000); } else { Functions.PrintText("You need a vehicle", 3000); } }
/// <summary> /// Player is close. /// </summary> private void PlayerIsClose() { if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(this.spawnPoint.Position) > 55) { return; } this.blip.Delete(); if (this.IsPrankCall) { DelayedCaller.Call(ReportControl_IsPrank, this, 10000); this.State = EShootoutState.Prank; } else { bool playerHasBeenSpotted = false; bool randomFight = Common.GetRandomBool(0, 300, 1); // Check whether player has been spotted foreach (LPed criminal in this.criminals) { //if (criminal.Exists()) if (criminal.isObjectValid()) { if (criminal.HasSpottedPed(LPlayer.LocalPlayer.Ped, false)) { playerHasBeenSpotted = true; break; } } } // If player has been spotted if (playerHasBeenSpotted || randomFight) { this.State = EShootoutState.Fighting; this.Engage(); this.Player_Yell(); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_FIGHT_SUSPECTS"), 5000); } } }
public void Revive() { Ped[] peds = World.GetAllPeds(); var sortedList = from element in peds where element.Exists() && element != LPlayer.LocalPlayer.Ped orderby element.Position.DistanceTo2D(LPlayer.LocalPlayer.Ped.Position) select element; Ped victim = sortedList.FirstOrDefault(); if (victim != null && LPlayer.LocalPlayer.Ped.Position.DistanceTo(victim.Position) < 3.0f) { LPlayer.LocalPlayer.Ped.Task.TurnTo(victim); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_in", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_loop", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_out", 4.0f); GTA.Native.Function.Call("REVIVE_INJURED_PED", victim); DelayedCaller.Call(delegate { victim.Task.ClearAll(); Functions.PrintHelp("The victim's condition was stabilized, call for a paramedic to have them taken to a hospital."); //victim.Task.EnterVehicle(LPlayer.LocalPlayer.LastVehicle, VehicleSeat.AnyPassengerSeat); }, this, 2000); }, this, 6000); }, this, 2000); }, this, 2000); } else { Functions.PrintText("There is no injured ped here", 4000); } }
/// <summary> /// Reports player to Control to confirm in contact with suspect. /// </summary> private void Player_Yell() { // Request two police backups if the player is not a SWAT/FIB member if (LPlayer.LocalPlayer.Model == new Model("M_Y_COP") || LPlayer.LocalPlayer.Model == new Model("M_M_FATCOP_01") || LPlayer.LocalPlayer.Model == new Model("M_Y_STROOPER") || LPlayer.LocalPlayer.Model == new Model("M_Y_COP_TRAFFIC")) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_NIKO, LPlayer.LocalPlayer.Username), Functions.GetStringFromLanguageFile("POLICE_SCANNER_OFFICER") + " " + LPlayer.LocalPlayer.Username); //LPlayer.LocalPlayer.Ped.SayAmbientSpeech("REQUEST_BACKUP"); Functions.PlaySound("REQUEST_BACKUP", true, false); DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_ROGER_THAT"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("THIS_IS_CONTROL INS_ALL_HANDS_TO CRIM_AN_OFFICER_IN_DANGER_OF_FIREARM_DISCHARGE_FROM_SUSPECT IN_OR_ON_POSITION SUSPECT ARMED_AND_DANGEROUS ALL_UNITS_PLEASE_RESPOND", this.spawnPoint.Position); }, this, 4000); } else if (LPlayer.LocalPlayer.Model == new Model("M_Y_SWAT") || LPlayer.LocalPlayer.Model == new Model("M_M_FBI")) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_NIKO_SWAT, LPlayer.LocalPlayer.Username, criminals[0].PersonaData.FullName), Functions.GetStringFromLanguageFile("POLICE_SCANNER_OFFICER") + " " + LPlayer.LocalPlayer.Username); LPlayer.LocalPlayer.Ped.SayAmbientSpeech("FIGHT"); DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_ROGER_THAT"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); Functions.PlaySoundUsingPosition(Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers) + "CRIM_TERRORIST_ACTIVITY IN_OR_ON_POSITION", this.spawnPoint.Position); }, this, 4000); } else // Special models like TLAD CIA models or a NOOSE Helicopter Pilot { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_NIKO_SWAT, LPlayer.LocalPlayer.Username, criminals[0].PersonaData.FullName), Functions.GetStringFromLanguageFile("POLICE_SCANNER_OFFICER") + " " + LPlayer.LocalPlayer.Username); LPlayer.LocalPlayer.Ped.SayAmbientSpeech("TARGET"); DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_ROGER_THAT"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); Functions.PlaySoundUsingPosition(Functions.CreateRandomAudioIntroString(EIntroReportedBy.Officers) + "CRIM_TERRORIST_ACTIVITY IN_OR_ON_POSITION", this.spawnPoint.Position); }, this, 4000); } }
/// <summary> /// Called when <see cref="NetworkMessages.RequestBackup"/> has been received. /// </summary> /// <param name="sender">The sender.</param> /// <param name="message">The message.</param> private void NeedBackupHandlerFunction(NetworkServer sender, ReceivedUserMessage message) { // The codes below are taken from the latest pull of LCPDFR API on GitHub (or latest download from LCPDFR website). // If you are the developer feel free to have fun with this handler (or add one other handler and mod it your way). // Read position and get associated area. Vector3 position = message.ReadVector3(); string area = Functions.GetAreaStringFromPosition(position); // Display message and blip. Functions.PrintText(string.Format("Officer {0} requests backup at {1}", sender.SafeName, area), 10000); Blip areaBlip = Functions.CreateBlipForArea(position, 25f); // Play sound. int rand = Common.GetRandomValue(0, 4); switch (rand) { case 0: Functions.PlaySoundUsingPosition("THIS_IS_CONTROL UNITS_PLEASE_BE_ADVISED INS_I_NEED_A_UNIT_FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 1: Functions.PlaySoundUsingPosition("THIS_IS_CONTROL ASSISTANCE_REQUIRED FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 2: Functions.PlaySoundUsingPosition("INS_THIS_IS_CONTROL_WE_HAVE CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; case 3: Functions.PlaySoundUsingPosition("ALL_UNITS_ALL_UNITS INS_WE_HAVE CRIM_AN_SOS FOR CRIM_AN_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION", position); break; } Log.Info("Client: Server issued a backup request on coordinates " + position.ToString() + " (Area: " + area + ")", this); // Cleanup. DelayedCaller.Call(parameter => areaBlip.Delete(), this, 20000); }
private void PlayerOnScene() { if (Functions.IsKeyDown(Keys.E)) { if (victim != null && LPlayer.LocalPlayer.Ped.Position.DistanceTo(victim.Position) < 3.0f) { LPlayer.LocalPlayer.Ped.Task.TurnTo(victim); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_in", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_loop", 4.0f); DelayedCaller.Call(delegate { LPlayer.LocalPlayer.Ped.Animation.Play(new AnimationSet("medic"), "medic_cpr_out", 4.0f); if (alive == false) { Functions.PrintText("The victim is deceased, secure the crime scene.", 4000); Functions.PrintHelp("Use " + CalloutsPlusMain.RequestParamedicModifierKey + " + " + CalloutsPlusMain.RequestParamedicKey + " to call for a paramedic who will clear the victim away. Be sure to secure the scene first!"); this.blip.Delete(); this.victim.Detach(); this.State = EPedState.None; } else { Functions.PrintText("The victim is still alive, call for a paramedic!", 4000); this.State = EPedState.None; } }, this, 6000); }, this, 2000); }, this, 2000); } } }
public void RepairVehicle(Vehicle vehiclePar) { Vehicle vehicle = vehiclePar; Vector3 dimensions = vehicle.Model.GetDimensions(); float width = dimensions.X; float length = dimensions.Y; Vector3 leftCorner = vehicle.GetOffsetPosition(new Vector3(-width / 2, length / 2 - 0.5f, 0)); Vector3 rightCorner = vehicle.GetOffsetPosition(new Vector3(width / 2, length / 2 - 0.5f, 0)); //Build rectangle by extending our left/ight corner vectors with the ful length now Vector3 leftOutmostCorner = vehicle.GetOffsetPosition(new Vector3(-width / 2, length - 1, 0)); Vector3 rightOutmostCorner = vehicle.GetOffsetPosition(new Vector3(width / 2, length - 1, 0)); Vector3 position = LPlayer.LocalPlayer.Ped.Position; bool isInRectangle = ((leftOutmostCorner.X - leftCorner.X) * (position.Y - leftCorner.Y) - (leftOutmostCorner.Y - leftCorner.Y) * (position.X - leftCorner.X) < 0) && ((rightOutmostCorner.X - rightCorner.X) * (position.Y - rightCorner.Y) - (rightOutmostCorner.Y - rightCorner.Y) * (position.X - rightCorner.X) >= 0) && ((rightCorner.X - leftCorner.X) * (position.Y - leftCorner.Y) - (rightCorner.Y - leftCorner.Y) * (position.X - leftCorner.X) >= 0) && ((rightOutmostCorner.X - leftOutmostCorner.X) * (position.Y - leftOutmostCorner.Y) - (rightOutmostCorner.Y - leftOutmostCorner.Y) * (position.X - leftOutmostCorner.X) < 0); if (isInRectangle) { //Functions.PrintHelp("ARGH SPAM"); Vehicle gtaVeh = vehicle; //World.GetClosestVehicle(LPlayer.LocalPlayer.Ped.Position, 2.0f); if (gtaVeh != null && gtaVeh.Exists() && !LPlayer.LocalPlayer.Ped.IsInVehicle()) { vehicle = LVehicle.FromGTAVehicle(gtaVeh); LPlayer.LocalPlayer.Ped.Task.ClearAll(); float H = vehicle.Heading; LPlayer.LocalPlayer.Ped.Task.TurnTo(vehicle.Position); LPlayer.LocalPlayer.Ped.Heading = H + 180; DelayedCaller.Call(RepairFunction1, this, 600, vehicle); } } }
/// <summary> /// Called when the callout has been accepted. Call base to set state to Running. /// </summary> /// <returns> /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed. /// </returns> public override bool OnCalloutAccepted() { bool isReady = base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); // Add blip this.blip = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; // Decide whether prank call or not if (Common.GetRandomBool(0, 5, 1) && (!isOfficerCalledIn | !isNGDRequestingAssistance)) { Log.Debug("OnCalloutAccepted: Is prank", this); this.SetAsPrankCall(); } else { try { this.criminals = new List <LPed>(); int random = Common.GetRandomValue(6, 16); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal); if (criminal.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { // Ensure ped is not in a building if (criminal.EnsurePedIsNotInBuilding(criminal.Position)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Biker2; criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Criminal, Relationship.Like); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; criminal.Weapons.RemoveAll(); criminal.Weapons.FromType(Weapon.TLAD_Automatic9mm).Ammo = 999; criminal.DefaultWeapon = Weapon.TLAD_Automatic9mm; if (Common.GetRandomBool(0, 3, 1)) { criminal.Weapons.FromType(Weapon.Rifle_AK47).Ammo = 150; } else { criminal.Weapons.FromType(Weapon.TLAD_AssaultShotgun).Ammo = 128; } criminal.Weapons.FromType(Weapon.Melee_Knife); criminal.Weapons.FromType(Weapon.Thrown_Molotov).Ammo = 1; criminal.Weapons.Select(Weapon.Thrown_Molotov); criminal.CanSwitchWeapons = true; Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } else { Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this); criminal.Delete(); } } } if (this.criminals.Count == 0) { isReady = false; } else { // Create Johnny johnny = new LPed(this.spawnPoint.Position.Around((float)10), "IG_JOHNNYBIKER", LPed.EPedGroup.MissionPed); johnny.PersonaData = new PersonaData(new DateTime(1974, 3, 17, 8, 30, 0, DateTimeKind.Utc), 13, "Johnny", "Klebitz", true, 9, true); johnny.RelationshipGroup = RelationshipGroup.Special; johnny.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); johnny.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (johnny.EnsurePedIsNotInBuilding(johnny.Position) == false) { johnny.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, 1.5f, 0); } // We don't want the criminal to flee yet johnny.DisablePursuitAI = true; johnny.EquipWeapon(); johnny.Weapons.RemoveAll(); johnny.Weapons.FromType(Weapon.Handgun_DesertEagle).Ammo = 999; johnny.Weapons.FromType(Weapon.TLAD_GrenadeLauncher).Ammo = 100; johnny.Weapons.FromType(Weapon.Melee_Knife).Ammo = 1; johnny.Weapons.Select(Weapon.TLAD_GrenadeLauncher); johnny.DefaultWeapon = Weapon.TLAD_GrenadeLauncher; int tempVar = Common.GetRandomValue(100, 500); johnny.MaxHealth = tempVar; johnny.Health = tempVar; johnny.Armor = 100; johnny.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); johnny.ComplianceChance = Common.GetRandomValue(0, 25); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { johnny.GPed }); Functions.AddPedToPursuit(this.pursuit, johnny); this.criminals.Add(johnny); // Create Clay clay = new LPed(johnny.Position, "IG_CLAY", LPed.EPedGroup.MissionPed); clay.PersonaData = new PersonaData(new DateTime(1977, 5, 16), 20, "Clay", "", true, 6, true); clay.RelationshipGroup = RelationshipGroup.Special; clay.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); clay.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); clay.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); clay.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); clay.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); clay.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (clay.EnsurePedIsNotInBuilding(clay.Position) == false) { clay.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, -1.5f, 0); } // We don't want the criminal to flee yet clay.DisablePursuitAI = true; clay.EquipWeapon(); clay.Weapons.RemoveAll(); clay.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999; clay.DefaultWeapon = Weapon.Handgun_Glock; clay.Weapons.FromType(Weapon.Rifle_M4).Ammo = 150; clay.Weapons.FromType(Weapon.TLAD_PipeBomb).Ammo = 3; clay.Weapons.FromType(Weapon.Melee_Knife); clay.Weapons.Select(Weapon.TLAD_PipeBomb); tempVar = Common.GetRandomValue(200, 400); clay.MaxHealth = tempVar; clay.Health = tempVar; clay.Armor = 20; clay.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); clay.ComplianceChance = Common.GetRandomValue(0, 25); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { clay.GPed }); Functions.AddPedToPursuit(this.pursuit, clay); this.criminals.Add(clay); // Create Terry terry = new LPed(johnny.Position, "IG_TERRY", LPed.EPedGroup.MissionPed); terry.PersonaData = new PersonaData(new DateTime(1977, 8, 29), 14, "Terry", "", true, 8, true); terry.RelationshipGroup = RelationshipGroup.Special; terry.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); terry.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); terry.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); terry.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, base.OnCalloutAccepted()); terry.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, base.OnCalloutAccepted()); terry.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (terry.EnsurePedIsNotInBuilding(terry.Position) == false) { terry.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(-1.0f, 1.5f, 0); } // We don't want the criminal to flee yet terry.DisablePursuitAI = true; terry.EquipWeapon(); terry.Weapons.RemoveAll(); terry.Weapons.FromType(Weapon.TLAD_Automatic9mm).Ammo = 999; terry.Weapons.FromType(Weapon.TLAD_AssaultShotgun).Ammo = 128; terry.Weapons.FromType(Weapon.SMG_MP5).Ammo = 300; terry.Weapons.FromType(Weapon.Melee_Knife); terry.Weapons.Select(Weapon.SMG_MP5); terry.DefaultWeapon = Weapon.SMG_MP5; terry.MaxHealth = 250; terry.Health = 250; terry.Armor = 30; terry.ComplianceChance = Common.GetRandomValue(0, 30); terry.AlwaysDiesOnLowHealth = base.OnCalloutAccepted(); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { terry.GPed }); Functions.AddPedToPursuit(this.pursuit, terry); this.criminals.Add(terry); } // If isNGDRequestingAssistance is true and isOfficerCalledIn is false, spawn NGD members to fight with the bikers // If spawned, it'll start fighting immediately if (isNGDRequestingAssistance & !isOfficerCalledIn) { NGD_Personnels = new List <LPed>(); random = Common.GetRandomValue(6, 13); for (int i = 0; i < random; i++) { LPed NGD = new LPed(World.GetPositionAround(this.spawnPoint.Position, 15f).ToGround(), Common.GetRandomCollectionValue <string>(this.NGD_MemberModels), LPed.EPedGroup.Cop); if (NGD.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { Functions.AddToScriptDeletionList(NGD, this); //Functions.SetPedIsOwnedByScript(NGD, this, true); NGD.RelationshipGroup = RelationshipGroup.Cop; NGD.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); NGD.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); NGD.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); // We don't want the personnel to flee yet //NGD.DisablePursuitAI = true; NGD.Weapons.RemoveAll(); NGD.Weapons.Glock.Ammo = 999; NGD.Weapons.BasicShotgun.Ammo = 999; if (Common.GetRandomBool(0, 100, 0)) { NGD.Weapons.BasicSniperRifle.Ammo = 100; NGD.Weapons.BasicSniperRifle.Select(); NGD.DefaultWeapon = Weapon.SniperRifle_Basic; } else { NGD.Weapons.AssaultRifle_M4.Ammo = 999; NGD.Weapons.AssaultRifle_M4.Select(); NGD.DefaultWeapon = Weapon.Rifle_M4; } NGD.PriorityTargetForEnemies = true; // Randomize NGD ped component variation Function.Call("SET_CHAR_RANDOM_COMPONENT_VARIATION", new Parameter[] { NGD.GPed }); this.NGD_Personnels.Add(NGD); } } this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create random vehicle Vehicle ngdveh1 = World.CreateVehicle(World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle ngdveh2 = World.CreateVehicle(ngdveh1.Position.Around(3f).ToGround()); // Release them as an ambient vehicle ngdveh1.NoLongerNeeded(); ngdveh2.NoLongerNeeded(); } // If isNGDRequestingAssistance is false and isOfficerCalledIn is true, spawn police officers to fight with the bikers // If spawned, it'll start fighting immediately else if (!isNGDRequestingAssistance & isOfficerCalledIn) { officers = new List <LPed>(); random = Common.GetRandomValue(4, 6); for (int i = 0; i < random; i++) { LPed officer = null; if (!World.GetZoneName(this.spawnPoint.Position).Contains("Alderney")) { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), Common.GetRandomCollectionValue <string>(copModel), LPed.EPedGroup.Cop); } else { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), stateTrooperModel, LPed.EPedGroup.Cop); } if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.Weapons.Uzi.Ammo = 999; officer.Weapons.Uzi.Select(); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create police vehicle Vehicle polveh1 = World.CreateVehicle(new Model("POLICE"), World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle polveh2 = World.CreateVehicle(new Model("POLICE"), polveh1.Position.Around(3f).ToGround()); polveh1.SirenActive = true; polveh2.SirenActive = polveh1.SirenActive; // Release them as an ambient vehicle polveh1.NoLongerNeeded(); polveh2.NoLongerNeeded(); } // If both isNGDRequestingAssistance and isOfficerCalledIn are true, spawn NGD members, NOOSE, and police officers to fight with the bikers // If spawned, it'll start fighting immediately else if (isNGDRequestingAssistance & isOfficerCalledIn) { NGD_Personnels = new List <LPed>(); officers = new List <LPed>(); random = Common.GetRandomValue(8, 12); for (int i = 0; i < random; i++) { LPed NGD = new LPed(World.GetPositionAround(this.spawnPoint.Position, 15f).ToGround(), Common.GetRandomCollectionValue <string>(this.NGD_MemberModels), LPed.EPedGroup.Cop); if (NGD.isObjectValid()) // derived from ValidityCheck - greetings to LtFlash { Functions.AddToScriptDeletionList(NGD, this); //Functions.SetPedIsOwnedByScript(NGD, this, true); NGD.RelationshipGroup = RelationshipGroup.Cop; NGD.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); NGD.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); NGD.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); // We don't want the personnel to flee yet //NGD.DisablePursuitAI = true; NGD.Weapons.RemoveAll(); NGD.Weapons.Glock.Ammo = 999; NGD.Weapons.BasicShotgun.Ammo = 999; if (Common.GetRandomBool(0, 100, 0)) { NGD.Weapons.BasicSniperRifle.Ammo = 100; NGD.Weapons.BasicSniperRifle.Select(); NGD.DefaultWeapon = Weapon.SniperRifle_Basic; } else { NGD.Weapons.AssaultRifle_M4.Ammo = 999; NGD.Weapons.AssaultRifle_M4.Select(); NGD.DefaultWeapon = Weapon.Rifle_M4; } NGD.PriorityTargetForEnemies = true; // Randomize NGD ped component variation Function.Call("SET_CHAR_RANDOM_COMPONENT_VARIATION", new Parameter[] { NGD.GPed }); this.NGD_Personnels.Add(NGD); } } random = Common.GetRandomValue(4, 8); for (int i = 0; i < random; i++) { LPed officer = null; if (!World.GetZoneName(this.spawnPoint.Position).Contains("Alderney")) { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), Common.GetRandomCollectionValue <string>(copModel), LPed.EPedGroup.Cop); } else { officer = new LPed(this.spawnPoint.Position.Around((float)Common.GetRandomValue(8, 15)), stateTrooperModel, LPed.EPedGroup.Cop); } if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.Weapons.Uzi.Ammo = 999; officer.Weapons.Uzi.Select(); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } for (int i = 0; i < 4; i++) { LPed officer = new LPed(World.GetPositionAround(this.spawnPoint.Position, 16.5f), "M_Y_SWAT"); if (officer.isObjectValid()) { Functions.AddToScriptDeletionList(officer, this); officer.RelationshipGroup = RelationshipGroup.Cop; officer.ChangeRelationship(RelationshipGroup.Cop, Relationship.Companion); officer.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); officer.ChangeRelationship(RelationshipGroup.Special, Relationship.Hate); officer.PriorityTargetForEnemies = true; this.officers.Add(officer); } } // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); // Create police and random vehicles Vehicle polveh1 = World.CreateVehicle(new Model("POLICE"), World.GetNextPositionOnStreet(this.spawnPoint.Position.Around((float)Common.GetRandomValue(10, 15))).ToGround()); Vehicle polveh2 = World.CreateVehicle(new Model("POLICE"), polveh1.Position.Around(3f).ToGround()); Vehicle polveh3 = World.CreateVehicle(new Model("NSTOCKADE"), World.GetNextPositionOnStreet(this.spawnPoint.Position).Around(2.0f).ToGround()); Vehicle ngdveh1 = World.CreateVehicle(World.GetNextPositionOnStreet(this.spawnPoint.Position.Around(18.1f)).ToGround()); Vehicle ngdveh2 = World.CreateVehicle(ngdveh1.Position.Around(3f).ToGround()); polveh1.SirenActive = true; polveh2.SirenActive = polveh1.SirenActive; polveh3.SirenActive = polveh2.SirenActive; // Release them as an ambient vehicle polveh1.NoLongerNeeded(); polveh2.NoLongerNeeded(); polveh3.NoLongerNeeded(); ngdveh1.NoLongerNeeded(); ngdveh2.NoLongerNeeded(); } isReady = true; } catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; } } // Add states if (isReady) { this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer); this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose); this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat); this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat); this.RegisterStateCallback(EShootoutState.Prank, this.Prank); this.State = EShootoutState.WaitingForPlayer; if (!this.IsPrankCall) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_JOHNNY, johnny.PersonaData.FullName, johnny.PersonaData.BirthDay), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); } else { DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_PRANK, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); }, this, Common.GetRandomValue(3000, 6001)); } Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); } return(isReady); }
/// <summary> /// Called every tick to process all plugin logic. /// </summary> public override void Process() { // If on duty and Z is down if (LPlayer.LocalPlayer.IsOnDuty && (Functions.IsKeyDown(Keys.Z) || (Functions.IsControllerInUse() && Functions.IsControllerKeyDown(GamepadButtonFlags.DPadRight)))) { DelayedCaller.Call( delegate { LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Test", 500); }, this, 500); if (this.lcpdfrPed == null || this.lcpdfrPed.Exists() || this.lcpdfrPed.IsAliveAndWell) { // Create a ped this.lcpdfrPed = new LPed(LPlayer.LocalPlayer.Ped.Position, "F_Y_HOOKER_01"); this.lcpdfrPed.NoLongerNeeded(); this.lcpdfrPed.AttachBlip(); this.lcpdfrPed.ItemsCarried = LPed.EPedItem.Drugs; LPed.EPedItem item = this.lcpdfrPed.ItemsCarried; this.lcpdfrPed.PersonaData = new PersonaData(DateTime.Now, 0, "Sam", "T", false, 1337, true); } } // If our ped exists and has been arrested, kill it if (this.lcpdfrPed != null && this.lcpdfrPed.Exists()) { if (this.lcpdfrPed.HasBeenArrested && this.lcpdfrPed.IsAliveAndWell) { this.lcpdfrPed.Die(); } } if (Functions.IsKeyDown(Keys.B)) { if (Functions.IsPlayerPerformingPullover()) { LHandle pullover = Functions.GetCurrentPullover(); if (pullover != null) { LVehicle vehicle = Functions.GetPulloverVehicle(pullover); if (vehicle != null && vehicle.Exists()) { vehicle.AttachBlip().Color = BlipColor.Cyan; if (vehicle.HasDriver) { // Change name of driver to Sam T. LPed driver = vehicle.GetPedOnSeat(VehicleSeat.Driver); if (driver != null && driver.Exists()) { // Modify name. driver.PersonaData = new PersonaData(DateTime.Now, 0, "Sam", "T", true, 0, false); string name = driver.PersonaData.FullName; Functions.PrintText("--- Pulling over: " + name + " ---", 10000); // Looking up the driver will make the vehicle explode. Functions.PedLookedUpInPoliceComputer += delegate(PersonaData data) { if (data.FullName == name) { DelayedCaller.Call(delegate { if (vehicle.Exists()) { vehicle.Explode(); } }, this, Common.GetRandomValue(5000, 10000)); } }; } } } } } else { // Disable pullovers for vehicle in front. GTA.Vehicle vehicle = World.GetClosestVehicle(LPlayer.LocalPlayer.Ped.GetOffsetPosition(new Vector3(0, 10, 0)), 5f); if (vehicle != null && vehicle.Exists()) { LVehicle veh = LVehicle.FromGTAVehicle(vehicle); if (veh != null) { veh.DisablePullover = true; veh.AttachBlip(); } } } } // Kill all partners. if (Functions.IsKeyDown(Keys.N)) { LHandle partnerManger = Functions.GetCurrentPartner(); LPed[] peds = Functions.GetPartnerPeds(partnerManger); if (peds != null) { foreach (LPed partner in peds) { if (partner.Exists()) { partner.Die(); } } } } // Send RequestBackup message in network game. if (Functions.IsKeyDown(Keys.X)) { if (Networking.IsInSession && Networking.IsConnected) { if (Networking.IsHost) { Vector3 position = LPlayer.LocalPlayer.Ped.Position; // Tell client we need backup. DynamicData dynamicData = new DynamicData(Networking.GetServerInstance()); dynamicData.Write(position); Networking.GetServerInstance().Send("API_Example", ENetworkMessages.RequestBackup, dynamicData); } } } }
//Function for requesting an ambulance for a single ped public void RequestMedic() { //Functions.AddTextToTextwall("I need a paramedic ASAP", "Officer " + LPlayer.LocalPlayer.Username); //LPlayer.LocalPlayer.Ped.PlayWalkieTalkieAnimation(""); if (CalloutsPlusMain.QuickSpawnMethod) { ambulance = new LVehicle(LPlayer.LocalPlayer.Ped.Position.Around(Common.GetRandomValue(30, 60)), "AMBULANCE"); } else { var ambulances = World.GetAllVehicles("AMBULANCE"); var selectedAmbulance = ambulances.FirstOrDefault(); if (selectedAmbulance != null && selectedAmbulance.Exists()) { ambulance = LVehicle.FromGTAVehicle(selectedAmbulance); //Functions.PrintText("Found an ambulance in the game already, using", 4000); para1 = ambulance.GetPedOnSeat(VehicleSeat.Driver); if (para1.Exists()) { para1.Task.ClearAllImmediately(); Functions.SetPedIsOwnedByScript(para1, this, true); para1.IsRequiredForMission = true; ambulance.IsRequiredForMission = true; para1.Task.WarpIntoVehicle(ambulance, VehicleSeat.Driver); DelayedCaller.Call(delegate { para1.Task.DriveTo(LPlayer.LocalPlayer.Ped.Position, 20f, false, false); para1.Task.AlwaysKeepTask = true; para1.BlockPermanentEvents = true; ambulance.SirenActive = true; ambulance.AttachBlip().Color = BlipColor.Green; Functions.AddTextToTextwall("A paramedic has been dispatched to your location, stand-by", "CONTROL"); //Functions.PlaySoundUsingPosition("INS_I_NEED_A_MEDICAL_TEAM_FOR_ERRR", LPlayer.LocalPlayer.Ped.Position); GTA.Native.Function.Call("ADD_STUCK_CAR_CHECK", new GTA.Native.Parameter[] { (Vehicle)ambulance, 2f, 12000 }); paramedicCanCancel = true; EMSStatus = State.Responding; medic = new AnimationSet("medic"); paramedicTimer = new GTA.Timer(1000); paramedicTimer.Start(); paramedicTimer.Tick += (paramedic_Tick); }, this, 2000); } else { para1 = ambulance.CreatePedOnSeat(VehicleSeat.Driver, "M_Y_PMEDIC"); para1.Task.ClearAllImmediately(); Functions.SetPedIsOwnedByScript(para1, this, true); para1.Task.WarpIntoVehicle(ambulance, VehicleSeat.Driver); DelayedCaller.Call(delegate { para1.Task.DriveTo(LPlayer.LocalPlayer.Ped.Position, 20f, false, false); para1.Task.AlwaysKeepTask = true; para1.BlockPermanentEvents = true; ambulance.SirenActive = true; ambulance.AttachBlip().Color = BlipColor.Green; Functions.AddTextToTextwall("A paramedic has been dispatched to your location, stand-by", "CONTROL"); //Functions.PlaySoundUsingPosition("INS_I_NEED_A_MEDICAL_TEAM_FOR_ERRR", LPlayer.LocalPlayer.Ped.Position); GTA.Native.Function.Call("ADD_STUCK_CAR_CHECK", new GTA.Native.Parameter[] { (Vehicle)ambulance, 2f, 12000 }); paramedicCanCancel = true; EMSStatus = State.Responding; medic = new AnimationSet("medic"); paramedicTimer = new GTA.Timer(1000); paramedicTimer.Start(); paramedicTimer.Tick += (paramedic_Tick); }, this, 2000); } if (ambulance.GetPedOnSeat(VehicleSeat.RightFront).Exists()) { ambulance.GetPedOnSeat(VehicleSeat.RightFront).Delete(); } } else { ambulance = new LVehicle( World.GetNextPositionOnStreet( LPlayer.LocalPlayer.Ped.Position.Around(Common.GetRandomValue(100, 150))), "AMBULANCE"); if (ambulance.Exists()) { ambulance.PlaceOnNextStreetProperly(); if (World.GetClosestVehicle(ambulance.Position, 5f).Exists() && World.GetClosestVehicle(ambulance.Position, 5f) != ambulance) { ambulance.Heading = World.GetClosestVehicle(ambulance.Position, 5f).Heading; } if (!para1.Exists()) { para1 = new LPed(ambulance.Position.Around(5f), "M_Y_PMEDIC"); para1.Task.ClearAllImmediately(); Functions.SetPedIsOwnedByScript(para1, this, true); para1.Task.WarpIntoVehicle(ambulance, VehicleSeat.Driver); DelayedCaller.Call(delegate { para1.Task.DriveTo(LPlayer.LocalPlayer.Ped.Position, 20f, false, false); para1.Task.AlwaysKeepTask = true; para1.BlockPermanentEvents = true; ambulance.SirenActive = true; ambulance.AttachBlip().Color = BlipColor.Green; Functions.AddTextToTextwall( "A paramedic has been dispatched to your location, stand-by", "CONTROL"); //Functions.PlaySoundUsingPosition("INS_I_NEED_A_MEDICAL_TEAM_FOR_ERRR", LPlayer.LocalPlayer.Ped.Position); GTA.Native.Function.Call("ADD_STUCK_CAR_CHECK", new GTA.Native.Parameter[] { (Vehicle)ambulance, 2f, 12000 }); paramedicCanCancel = true; EMSStatus = State.Responding; medic = new AnimationSet("medic"); paramedicTimer = new GTA.Timer(1000); paramedicTimer.Start(); paramedicTimer.Tick += (paramedic_Tick); }, this, 2000); } } } } }
/// <summary> /// Player is close. /// </summary> private void PlayerIsClose() { if (LPlayer.LocalPlayer.Ped.Position.DistanceTo(this.spawnPoint.Position) > 55) { return; } this.blip.Delete(); if (this.IsPrankCall) { DelayedCaller.Call( delegate { // Tell control it was a prank Functions.PlaySound("EMERG_PRANK_CALL", true, false); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END"), 5000); Functions.AddTextToTextwall(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_PRANK_END_TW"), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); this.End(); }, this, 10000); this.State = EShootoutState.Prank; } else { bool playerHasBeenSpotted = false; bool randomFight = Common.GetRandomBool(0, 300, 1); // Check whether player has been spotted foreach (LPed criminal in this.criminals) { if (ValidityCheck.isObjectValid(criminal)) { if (criminal.HasSpottedPed(LPlayer.LocalPlayer.Ped, false)) { playerHasBeenSpotted = true; break; } } } // If player has been spotted if (playerHasBeenSpotted || randomFight) { this.State = EShootoutState.Fighting; this.Engage(); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_SHOOTOUT_FIGHT_SUSPECTS"), 5000); if (LPlayer.LocalPlayer.Model == new Model("M_Y_COP") || LPlayer.LocalPlayer.Model == new Model("M_M_FATCOP_01") || LPlayer.LocalPlayer.Model == new Model("M_Y_STROOPER") || LPlayer.LocalPlayer.Model == new Model("M_Y_COP_TRAFFIC")) { LPlayer.LocalPlayer.Ped.SayAmbientSpeech("SPOT_SUSPECT"); } else if (LPlayer.LocalPlayer.Model == new Model("M_Y_SWAT") || LPlayer.LocalPlayer.Model == new Model("M_M_FBI")) { LPlayer.LocalPlayer.Ped.SayAmbientSpeech("DRAW_GUN"); } else { LPlayer.LocalPlayer.Ped.SayAmbientSpeech("TARGET"); } } } }
/// <summary> /// Called when the callout has been accepted. Call base to set state to Running. /// </summary> /// <returns> /// True if callout was setup properly, false if it failed. Calls <see cref="End"/> when failed. /// </returns> public override bool OnCalloutAccepted() { bool isReady = base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); // Add blip this.blip = Functions.CreateBlipForArea(this.spawnPoint.Position, 30f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; // Decide whether prank call or not if (Common.GetRandomBool(0, 5, 1)) { Log.Debug("OnCalloutAccepted: Is prank", this); this.SetAsPrankCall(); } else { try { this.criminals = new List <LPed>(); int random = Common.GetRandomValue(6, 13); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.criminalModels), LPed.EPedGroup.Criminal); if (ValidityCheck.isObjectValid(criminal)) { // Ensure ped is not in a building if (criminal.EnsurePedIsNotInBuilding(criminal.Position)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Biker2; criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; // Set up weapons criminal.Weapons.RemoveAll(); criminal.Weapons.FromType(Weapon.Handgun_Glock).Ammo = 999; criminal.Weapons.FromType(Weapon.Shotgun_Basic).Ammo = 120; criminal.Weapons.FromType(Weapon.Melee_Knife); criminal.Weapons.FromType(Weapon.Thrown_Molotov).Ammo = 2; criminal.Weapons.Select(Weapon.Thrown_Molotov); criminal.DefaultWeapon = Weapon.Shotgun_Basic; criminal.ComplianceChance = Common.GetRandomValue(25, 75); Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } else { Log.Debug("OnCalloutAccepted: Failed to place ped properly outside of building", this); criminal.Delete(); } } } if (this.criminals.Count == 0) { isReady = false; } else { // Create Johnny johnny = new LPed(this.spawnPoint.Position.Around((float)10), "IG_JOHNNYBIKER", LPed.EPedGroup.MissionPed); johnny.PersonaData = new PersonaData(new DateTime(1974, 3, 17, 8, 30, 0, DateTimeKind.Utc), 13, "Johnny", "Klebitz", true, 9, true); johnny.RelationshipGroup = RelationshipGroup.Special; johnny.ChangeRelationship(RelationshipGroup.Special, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Companion); johnny.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Hate); johnny.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Biker2, true); johnny.CantBeDamagedByRelationshipGroup(RelationshipGroup.Special, true); johnny.BecomeMissionCharacter(); // Place near any criminal ped if he's in a building if (!johnny.EnsurePedIsNotInBuilding(johnny.Position)) { johnny.Position = criminals[Common.GetRandomValue(0, criminals.Count - 1)].Position + new Vector3(1.0f, 1.5f, 0); } // We don't want the criminal to flee yet johnny.DisablePursuitAI = true; // Set up weapons johnny.Weapons.RemoveAll(); johnny.Weapons.DesertEagle.Ammo = 999; johnny.Weapons.AssaultRifle_AK47.Ammo = 300; johnny.Weapons.Knife.Ammo = 1; johnny.Weapons.AssaultRifle_AK47.Select(); johnny.DefaultWeapon = Weapon.Rifle_AK47; johnny.ComplianceChance = Common.GetRandomValue(0, 30); // Make default of the ped's component variation Function.Call("SET_CHAR_DEFAULT_COMPONENT_VARIATION", new Parameter[] { johnny.GPed }); Functions.AddPedToPursuit(this.pursuit, johnny); this.criminals.Add(johnny); } // Chance to spawn another bunch of suspects fighting each other if (Common.GetRandomBool(0, 2, 1)) { random = Common.GetRandomValue(7, 15); for (int i = 0; i < random; i++) { LPed criminal = new LPed(this.spawnPoint.Position, Common.GetRandomCollectionValue <string>(this.mafiaModels), LPed.EPedGroup.Criminal); if (ValidityCheck.isObjectValid(criminal)) { Functions.AddToScriptDeletionList(criminal, this); Functions.SetPedIsOwnedByScript(criminal, this, true); criminal.RelationshipGroup = RelationshipGroup.Gang_Italian; criminal.ChangeRelationship(RelationshipGroup.Gang_Italian, Relationship.Companion); criminal.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate); criminal.ChangeRelationship(RelationshipGroup.Gang_Biker2, Relationship.Hate); criminal.CantBeDamagedByRelationshipGroup(RelationshipGroup.Gang_Italian, true); // We don't want the criminal to flee yet criminal.DisablePursuitAI = true; criminal.Weapons.RemoveAll(); criminal.Weapons.Glock.Ammo = 999; criminal.Weapons.Uzi.Ammo = 999; criminal.Weapons.Knife.Ammo = 1; if (Common.GetRandomBool(0, 50, 1)) { criminal.Weapons.Uzi.Select(); criminal.DefaultWeapon = Weapon.SMG_Uzi; } else { criminal.Weapons.AssaultRifle_M4.Ammo = 999; criminal.Weapons.AssaultRifle_M4.Select(); criminal.DefaultWeapon = Weapon.Rifle_M4; } Functions.AddPedToPursuit(this.pursuit, criminal); this.criminals.Add(criminal); } } // Chance to start fighting immediately if (Common.GetRandomBool(0, 2, 1)) { this.State = EShootoutState.Fighting; this.Engage(); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_3_UNITS_FROM POSITION FOR CRIM_A_DOMESTIC_DISTURBANCE", LPlayer.LocalPlayer.Ped.Position); } } isReady = true; } catch (Exception ex) { Log.Error("OnCalloutAccepted: Cannot create Pursuit instance: " + ex, this); isReady = false; } } // Add states if (isReady) { this.RegisterStateCallback(EShootoutState.WaitingForPlayer, this.WaitingForPlayer); this.RegisterStateCallback(EShootoutState.PlayerIsClose, this.PlayerIsClose); this.RegisterStateCallback(EShootoutState.InCombat, this.InCombat); this.RegisterStateCallback(EShootoutState.Fighting, this.InCombat); this.RegisterStateCallback(EShootoutState.Prank, this.Prank); this.State = EShootoutState.WaitingForPlayer; if (!this.IsPrankCall) { Functions.AddTextToTextwall(string.Format(Resources.TEXT_INFO_RELAY_SV_JOHNNY, johnny.PersonaData.FullName, johnny.PersonaData.BirthDay), Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); } else { DelayedCaller.Call(delegate { Functions.AddTextToTextwall(Resources.TEXT_INFO_RELAY_SV_JOHNNY_PRANK, Functions.GetStringFromLanguageFile("POLICE_SCANNER_CONTROL")); // Request one backup unit automatically Functions.RequestPoliceBackupAtPosition(LPlayer.LocalPlayer.Ped.Position); Functions.PlaySoundUsingPosition("DFROM_DISPATCH_2_UNITS_FROM POSITION", LPlayer.LocalPlayer.Ped.Position); }, this, Common.GetRandomValue(3000, 6001)); } Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); } return(isReady); }
public void VehicleIdCheck() { Functions.AddTextToTextwall("Control can I get some details on this vehicle please?", "Officer " + LPlayer.LocalPlayer.Username); Vehicle car = null; if (Functions.IsPlayerPerformingPullover() && CalloutsPlusMain.AutoVehicleCheck) { LHandle pullover = Functions.GetCurrentPullover(); if (pullover != null) { car = Functions.GetPulloverVehicle(pullover); } } else { if (LPlayer.LocalPlayer.Ped.IsInVehicle()) { Vehicle vehicle = LPlayer.LocalPlayer.LastVehicle; Vector3 dimensions = vehicle.Model.GetDimensions(); float width = dimensions.X; float length = dimensions.Y; Vector3 centerPoint = vehicle.GetOffsetPosition(new Vector3(0, length / 2 + 4, 0)); car = World.GetClosestVehicle(centerPoint, 2.0f); } else { LPlayer.LocalPlayer.Ped.PlayWalkieTalkieAnimation(""); car = World.GetClosestVehicle(LPlayer.LocalPlayer.Ped.Position, 3.0f); } } string flags = ""; if (car != null && car.Exists()) { Functions.AddTextToTextwall("Affirmative, standby for details", "CONTROL"); if (car.Metadata.registration == null) { bool isRegistered = Common.GetRandomBool(0, 10, 1); if (isRegistered == true) { car.Metadata.registration = "UNREGISTERED"; } else { car.Metadata.registration = Common.GetRandomValue(1990, 2014); } } if (car.Metadata.stolen == null) { car.Metadata.stolen = Common.GetRandomBool(0, 8, 1); } if (car.Metadata.insured == null) { car.Metadata.insured = Common.GetRandomBool(0, 6, 1); } if (car.Metadata.tax == null) { car.Metadata.tax = Common.GetRandomBool(0, 6, 1); } if (car.Name.Equals("TAXI") || car.Name.Equals("TAXI2")) { if (car.Metadata.taxi == null) { car.Metadata.taxi = Common.GetRandomBool(0, 10, 1); } } DelayedCaller.Call(delegate { Functions.AddTextToTextwall("Vehicle Make: " + car.Name); Functions.AddTextToTextwall("Vehicle Colour: " + car.Color); Functions.AddTextToTextwall("Registration Year: " + car.Metadata.registration); if (car.Metadata.stolen == true) { flags += "STOLEN, "; } if (car.Metadata.insured == true) { flags += "UNINSURED, "; } if (car.Metadata.tax == true) { flags += "NO TAX/SORN, "; } if (car.Metadata.taxi == true) { flags += "INVALID TAXI LICENSE, "; } Functions.AddTextToTextwall("Flags: " + flags); Functions.AddTextToTextwall("END"); }, this, 5000); } else { Functions.AddTextToTextwall("We're unable to fetch vehicle details. Verify the target and try again", "CONTROL"); } }
//Function for requesting a tow truck public void RequestTowTruck() { Functions.AddTextToTextwall("Can I get a removal truck at my location please", "OFFICER " + LPlayer.LocalPlayer.Username); towedCar = World.GetClosestVehicle(LPlayer.LocalPlayer.Ped.Position, 3f); if (towedCar != null && towedCar.Exists()) { if (CalloutsPlusMain.QuickSpawnMethod == true) // if quick spawn method is set to true, the vehicle will spawn much closer { truck = new LVehicle(LPlayer.LocalPlayer.Ped.Position.Around(Common.GetRandomValue(30, 60)), "PACKER"); } else { truck = new LVehicle(LPlayer.LocalPlayer.Ped.Position.Around(Common.GetRandomValue(100, 150)), "PACKER"); } if (truck != null && truck.Exists()) { truckDriver = new LPed(truck.Position.Around(2f), "m_y_mechanic_02"); } if (towedCar.Model.isBoat) { Functions.PrintText("[TOW TRUCK] We can't tow a boat!", 4000); truck.NoLongerNeeded(); truckDriver.NoLongerNeeded(); towTruckCalledOut = false; } else if (towedCar.Model.isHelicopter) { Functions.PrintText("[TOW TRUCK] We can't tow a helicopter!", 4000); truck.NoLongerNeeded(); truckDriver.NoLongerNeeded(); towTruckCalledOut = false; } else if (towedCar.Model.Hash == 2053223216 || towedCar.Model.Hash == 850991848 || towedCar.Model.Hash == 2307837162 || towedCar.Model.Hash == 3581397346 || towedCar.Model.Hash == 1938952078 || towedCar.Model.Hash == 1353720154 || towedCar.Model.Hash == 904750859 || towedCar.Model.Hash == 569305213) { Functions.PrintText( "[TOW TRUCK] We can't tow that, it's too big. Send an impound cop instead.", 4000); truck.NoLongerNeeded(); truckDriver.NoLongerNeeded(); towTruckCalledOut = false; } else { if (truck != null && truck.Exists()) { if (truckDriver != null && truckDriver.Exists()) { truck.PlaceOnNextStreetProperly(); if (World.GetClosestVehicle(truck.Position, 5f).Exists() && World.GetClosestVehicle(truck.Position, 5f) != truck) { truck.Heading = World.GetClosestVehicle(truck.Position, 5f).Heading; } truck.Extras(1).Enabled = false; truck.Extras(2).Enabled = false; truck.Extras(3).Enabled = false; truck.Extras(4).Enabled = false; truckDriver.WarpIntoVehicle(truck, VehicleSeat.Driver); truck.AttachBlip().Color = BlipColor.Yellow; DelayedCaller.Call(delegate { Functions.AddTextToTextwall("Affirmative, a removal truck has been dispatched", "CONTROL"); towTruckCanCancel = true; truckDriver.Task.DriveTo(LPlayer.LocalPlayer.Ped.Position, 20f, true, false); GTA.Native.Function.Call("ADD_STUCK_CAR_CHECK", new GTA.Native.Parameter[] { (Vehicle)truck, 2f, 12000 }); truckDriver.MakeProofTo(false, true, true, true, false); TTStatus = State.Responding; towTruckTimer = new GTA.Timer(1000); towTruckTimer.Tick += TowTruck_Tick; towTruckTimer.Start(); }, this, 100); } else { Functions.AddTextToTextwall("Negative we have no drivers available right now.", "CONTROL"); truck.Delete(); towTruckCalledOut = false; } } else { Functions.AddTextToTextwall("Negative at this time, we have no available trucks.", "CONTROL"); driver.Delete(); towTruckCalledOut = false; } } } else { Functions.PrintText("There is no vehicle here, tow truck will not be sent", 4000); towTruckCalledOut = false; } }
//Tow truck tick private void TowTruck_Tick(object sender, EventArgs e) { switch (TTStatus) { case State.Responding: if (GTA.Native.Function.Call <bool>("IS_CAR_STUCK", new GTA.Native.Parameter[] { (Vehicle)truck }) || truck.IsUpsideDown) { truck.Position = World.GetNextPositionOnStreet(truck.Position.Around(10f)); //truck.PlaceOnNextStreetProperly(); } if (truck.Position.DistanceTo2D(LPlayer.LocalPlayer.Ped.Position) <= 35) { towTruckCanCancel = false; truckDriver.Task.DriveTo(towedCar.Position, 8f, false, true); if (truck.Position.DistanceTo2D(towedCar.Position) <= 15f) { truck.AttachBlip().Delete(); truck.HazardLightsOn = true; truck.SoundHorn(2000); truck.Extras(5).Enabled = true; truckDriver.Task.LeaveVehicle(truck, true); DelayedCaller.Call(delegate { TTStatus = State.RunToObject; }, this, 2000); } } break; case State.RunToObject: if (TTTaskSeq == null) { TTTaskSeq = new TaskSequence(); TTTaskSeq.AddTask.RunTo(towedCar.Position); TTTaskSeq.AddTask.UseMobilePhone(5000); TTTaskSeq.Perform(truckDriver); } if (truckDriver.Position.DistanceTo2D(towedCar.Position) <= 5f) { TTTaskSeq.Dispose(); TTTaskSeq = null; truckDriver.DrawTextAboveHead("Sure, I'll remove this " + towedCar.Name + ", just gonna go ahead and load up", 5000); TTStatus = State.PerformDuty; } break; case State.PerformDuty: if (towedCar != null && towedCar.Exists()) { towedCar.EngineRunning = false; towedCar.CloseAllDoors(); float num1 = 0.0f; float num2; float dimension = -towedCar.Model.GetDimensions().Y + towedCar.Model.GetDimensions().Y; if (towedCar.Model.Hash == 1171614426 || towedCar.Model.Hash == -1987130134 || towedCar.Model.Hash == 583100975 || towedCar.Model.Hash == 1638119866) { num2 = towedCar.Model.GetDimensions().Y; } else { num1 = (float)Math.PI; num2 = towedCar.Model.GetDimensions().Y - 0.150000005960464f; } if ((double)dimension < (double)4.34) { num2 = (float)4.34 / 2f; } int num3 = (int)byte.MaxValue; while (num3 > 0) { GTA.Native.Function.Call("SET_VEHICLE_ALPHA", new GTA.Native.Parameter[] { towedCar, num3 }); num3 -= 12; } float num4 = 0.0f; for (int i = 0; i < 50; ++i) { Vehicle veh = towedCar; Vector3 pos = LPlayer.LocalPlayer.Ped.Position; Vector3 street = World.GetNextPositionOnStreet(((Vector3)pos.Around((float)(180.0 + (double)i * 1.0)))); veh.Position = street; towedCar.PlaceOnNextStreetProperly(); towedCar.PlaceOnGroundProperly(); num4 = (float)towedCar.Position.Z - World.GetGroundZ(towedCar.Position); if (towedCar.Rotation.X < 2.0 && towedCar.Rotation.X > -2.0 && towedCar.Rotation.X != 0.0) { break; } } Vehicle truckv = truck; GTA.Native.Function.Call("ATTACH_CAR_TO_CAR", new GTA.Native.Parameter[] { towedCar, truckv, 0, 0.0f, 1.2 - num2, 0.11 + num4, 0.0f, 0.0f, num1 }); //truck.Extras(5).Enabled = false; truckv.Extras(5).Enabled = false; truckv.HazardLightsOn = false; TTStatus = State.Leave; break; } break; case State.Leave: truckDriver.Task.CruiseWithVehicle(truck, 20f, true); truckDriver.Task.AlwaysKeepTask = true; if (truckDriver.IsInVehicle(truck)) { TTStatus = State.None; break; } break; case State.None: truckDriver.NoLongerNeeded(); truck.NoLongerNeeded(); towedCar.NoLongerNeeded(); towTruckTimer.Stop(); towTruckCalledOut = false; break; } }
void qTimer_Tick(object sender, EventArgs e) { if (IsTrafficStop) { if (m.IsKeyPressed(System.Windows.Forms.Keys.F9, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("I suspect you've been Driving While Intoxicated, I need you to take a breath test", 3000); Functions.PrintHelp("Conducting breathtest..."); DelayedCaller.Call(delegate { int BreathTestScore; if (suspect.IsRagdoll) { BreathTestScore = Common.GetRandomValue(CalloutsPlusMain.DrinkDriveLimit, CalloutsPlusMain.DrinkDriveLimit + 100); } else { BreathTestScore = Common.GetRandomValue(0, CalloutsPlusMain.DrinkDriveLimit + 100); } String result; String measurement = "mg/100ml"; double multiplier = Math.Floor((double)BreathTestScore / CalloutsPlusMain.DrinkDriveLimit); if (BreathTestScore >= CalloutsPlusMain.DrinkDriveLimit) { result = "~r~FAIL~w~"; } else { result = "~g~PASS~w~"; } //Finally print the results Functions.PrintHelp("Result: " + result + "~n~Score: " + BreathTestScore + measurement + " (Limit: " + CalloutsPlusMain.DrinkDriveLimit + "mg/100ml)~n~" + multiplier + "x Legal limit"); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 4000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F10, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Your car is being seized by the LCPD, you're going to have to walk from now on.", 3000); Functions.PrintHelp("You've seized this ped's car, deal with it how you see fit."); DelayedCaller.Call(delegate { int response = Common.GetRandomValue(0, 3); switch (response) { case 0: suspect.DrawTextAboveHead("Oh great, just what I wanted!", 4000); break; case 1: suspect.DrawTextAboveHead("No! My car!", 4000); break; case 2: suspect.DrawTextAboveHead("What?! Why? this isn't fair", 4000); break; case 3: suspect.DrawTextAboveHead("Don't you f***s earn enough money to buy your own car?", 4000); break; } suspect.NoLongerNeeded(); sCar.PassengersLeaveVehicle(true); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 2000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F11, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Alright, you're free to go", 3000); Functions.PrintHelp("You released the ped, they will return to their vehicle and drive away."); suspect.Task.CruiseWithVehicle(sCar, 20f, true); suspect.Task.AlwaysKeepTask = true; suspect.WantedByPolice = false; DelayedCaller.Call(delegate { suspect.NoLongerNeeded(); sCar.NoLongerNeeded(); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 5000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F12, System.Windows.Forms.Keys.None, true)) { if (CalloutsPlusMain.QuestionSuspectModifierKey != System.Windows.Forms.Keys.None) { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectModifierKey + "+" + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } else { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } m.HasQuestioningFired = false; qTimer.Stop(); } } else { if (m.IsKeyPressed(System.Windows.Forms.Keys.F9, System.Windows.Forms.Keys.None, true)) { Functions.PrintHelp("You attempt to extort the suspect..."); if (suspect.ItemsCarried == LPed.EPedItem.StolenCards) { } m.HasQuestioningFired = false; qTimer.Stop(); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F10, System.Windows.Forms.Keys.None, true)) { Functions.PrintHelp("You picked option 2, it does f**k all"); m.HasQuestioningFired = false; qTimer.Stop(); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F11, System.Windows.Forms.Keys.None, true)) { //LPlayer.LocalPlayer.Ped.DrawTextAboveHead("Alright, you're free to go", 3000); Functions.PrintHelp("You released the ped, they will leave your vehicle."); suspect.WantedByPolice = false; DelayedCaller.Call(delegate { suspect.NoLongerNeeded(); m.HasQuestioningFired = false; qTimer.Stop(); }, this, 5000); } else if (m.IsKeyPressed(System.Windows.Forms.Keys.F12, System.Windows.Forms.Keys.None, true)) { if (CalloutsPlusMain.QuestionSuspectModifierKey != System.Windows.Forms.Keys.None) { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectModifierKey + "+" + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } else { Functions.PrintHelp("Menu Cancelled, you can press " + CalloutsPlusMain.QuestionSuspectKey + " again to restart or pull the suspect out of your car to deal with him as normal."); } m.HasQuestioningFired = false; qTimer.Stop(); } } }
//Main tick for the plugin public override void Process() { //Testing area //end if (LPlayer.LocalPlayer.IsOnDuty && AutoVehicleCheck) { if (Functions.IsPlayerPerformingPullover()) { LHandle pullover = Functions.GetCurrentPullover(); if (pullover != null) { if (HasVehicleBeenChecked == false) { HasVehicleBeenChecked = true; DelayedCaller.Call(delegate { playerFunc.VehicleIdCheck(); }, this, 2000); } } } else { HasVehicleBeenChecked = false; } } if (LPlayer.LocalPlayer.LastVehicle != null) { //Keybind check for the repair function if (IsKeyPressed(RepairEngineKey, RepairEngineModifierKey, false)) { playerFunc.RepairVehicle(LPlayer.LocalPlayer.LastVehicle); } //Keybind check for the vehicle hazard lights toggle if (IsKeyPressed(VehicleHazardsKey, VehicleHazardsModifierKey, false)) { playerFunc.StopLights(); } } //Keybind check for revive system if (IsKeyPressed(RevivePedKey, RevivePedModifierKey, false)) { playerFunc.Revive(); } //Keybind check for removal team dispatch if (IsKeyPressed(RequestRemovalKey, RequestRemovalModifierKey, true)) { if (dispatcher.removalCalledOut == false) { dispatcher.RequestRemoval(); dispatcher.removalCalledOut = true; } else { if (dispatcher.removalCanCancel) { Functions.AddTextToTextwall("Dispatch, situation code 4. Removal no longer required", "Officer " + LPlayer.LocalPlayer.Username); Functions.AddTextToTextwall("10-4, removal has been advised.", "DISPATCH"); dispatcher.driver.NoLongerNeeded(); dispatcher.dropOffDriver.NoLongerNeeded(); dispatcher.copCar.AttachBlip().Delete(); dispatcher.copCar.NoLongerNeeded(); if (dispatcher.removalCar.Exists()) { dispatcher.removalCar.NoLongerNeeded(); } dispatcher.removalCalledOut = false; } } } //Keybind check for paramedic dispatch if (IsKeyPressed(RequestParamedicKey, RequestParamedicModifierKey, true)) { if (dispatcher.paramedicCalledOut == false) { DelayedCaller.Call(delegate { dispatcher.RequestMedic(); dispatcher.paramedicCalledOut = true; }, this, 12000); } else { if (dispatcher.paramedicCanCancel == true) { Functions.AddTextToTextwall("Dispatch, situation code 4. Paramedic no longer required", "Officer " + LPlayer.LocalPlayer.Username); Functions.AddTextToTextwall("10-4, paramedic has been advised.", "DISPATCH"); dispatcher.para1.NoLongerNeeded(); dispatcher.ambulance.AttachBlip().Delete(); dispatcher.ambulance.NoLongerNeeded(); dispatcher.paramedicCalledOut = false; } } } if (IsKeyPressed(VehicleCheckKey, VehicleCheckModifierKey, true)) { playerFunc.VehicleIdCheck(); } //Keybind check for tow truck dispatch if (IsKeyPressed(TowTruckKey, TowTruckModifierKey, true)) { if (dispatcher.towTruckCalledOut == false) { dispatcher.RequestTowTruck(); dispatcher.towTruckCalledOut = true; } else { if (dispatcher.towTruckCanCancel == true) { Functions.AddTextToTextwall("Dispatch, situation code 4. Tow truck no longer required", "Officer " + LPlayer.LocalPlayer.Username); Functions.AddTextToTextwall("10-4, tow truck has been advised.", "DISPATCH"); dispatcher.truckDriver.NoLongerNeeded(); dispatcher.truck.AttachBlip().Delete(); dispatcher.truck.NoLongerNeeded(); dispatcher.towTruckCalledOut = false; } } } //Keybind check for barrier placement if (IsKeyPressed(PlaceBarrierKey, PlaceBarrierModifierKey, true)) { barriers.PlaceBarrier(); } //Keybind for the questioning feature if (LPlayer.LocalPlayer.IsOnDuty) { if (Functions.IsPlayerPerformingPullover()) { LHandle po = Functions.GetCurrentPullover(); pulloverCar = Functions.GetPulloverVehicle(po); playerFunc.sCar = pulloverCar; } if (LPlayer.LocalPlayer.LastVehicle != null) { if (!HasQuestioningFired) { var suspect = LPlayer.LocalPlayer.LastVehicle.GetPedOnSeat(LPlayer.LocalPlayer.LastVehicle.IsSeatFree(VehicleSeat.LeftRear) ? VehicleSeat.RightRear : VehicleSeat.LeftRear); if (suspect != null && suspect.Exists() && suspect.Model != "M_Y_COP") { Functions.PrintHelp("You've detained a ~r~suspect~w~ inside your vehicle. You can question them by entering the driver's seat and pressing Q."); HasQuestioningFired = true; } } } } if (LPlayer.LocalPlayer.Ped.IsInVehicle() && IsKeyPressed(QuestionSuspectKey, QuestionSuspectModifierKey, true)) { playerFunc.Questioning(); } }
public override bool OnCalloutAccepted() { base.OnCalloutAccepted(); this.pursuit = Functions.CreatePursuit(); Functions.SetPursuitCopsCanJoin(this.pursuit, false); Functions.SetPursuitDontEnableCopBlips(this.pursuit, true); this.vehicle1 = new LVehicle(World.GetNextPositionOnStreet(this.spawnPosition), Common.GetRandomCollectionValue <string>(this.vehicleModels)); if (vehicle1 != null && vehicle1.Exists()) { vehicle1.PlaceOnNextStreetProperly(); Vector3 dimensions = vehicle1.Model.GetDimensions(); float width = dimensions.X; float length = dimensions.Y; this.vehicle2 = new LVehicle(vehicle1.GetOffsetPosition(new Vector3(0, length / 2 + 8, 0)), Common.GetRandomCollectionValue <string>(this.vehicleModels)); if (vehicle2 != null && vehicle2.Exists()) { //vehicle2.PlaceOnNextStreetProperly(); DelayedCaller.Call(delegate { vehicle1.ApplyForceRelative(new Vector3(0, 60, 0)); DelayedCaller.Call(delegate { vehicle1.Speed = 0; vehicle2.Speed = 0; this.blip = Functions.CreateBlipForArea(vehicle1.Position, 20f); this.blip.Display = BlipDisplay.ArrowAndMap; this.blip.RouteActive = true; vic1 = new LPed(vehicle1.Position.Around(2f), Common.GetRandomCollectionValue <string>(this.victimModels)); vic2 = new LPed(vehicle2.Position.Around(2f), Common.GetRandomCollectionValue <string>(this.victimModels)); vic1.WarpIntoVehicle(vehicle1, VehicleSeat.Driver); vic2.WarpIntoVehicle(vehicle2, VehicleSeat.Driver); vic1.Health = 50; vic2.Health = 20; vic1.LeaveVehicle(); vic2.LeaveVehicle(); DelayedCaller.Call(delegate { vic1.Task.FightAgainst(vic2); vic2.Task.FightAgainst(vic1); }, this, 1000); }, this, 500); }, this, 1000); Functions.PrintText(Functions.GetStringFromLanguageFile("CALLOUT_GET_TO_CRIME_SCENE"), 8000); this.RegisterStateCallback(EPedState.WaitingForPlayer, this.WaitingForPlayer); this.RegisterStateCallback(EPedState.PlayerOnScene, this.PlayerOnScene); this.RegisterStateCallback(EPedState.None, this.CalloutOver); this.State = EPedState.WaitingForPlayer; } else { Functions.AddTextToTextwall("Disregard previous, situation is code 4", "CONTROL"); // vehicle 2 didn't spawn this.End(); } } else { Functions.AddTextToTextwall("Disregard previous, situation is code 4", "CONTROL"); // vehicle 1 didn't spawn this.End(); } return(true); }