public override bool OnCalloutAccepted() { SuspectCar = new Vehicle("STOCKADE", SpawnPoint); SuspectCar.RandomiseLicencePlate(); SuspectCar.MakePersistent(); new Ped(Vector3.Zero); Suspect.MakeMissionPed(); SuspectBlip = Suspect.AttachBlip(); SuspectBlip.Color = Color.Red; Suspect.Inventory.GiveNewWeapon(new WeaponAsset(firearmsToSelectFrom[AssortedCalloutsHandler.rnd.Next(firearmsToSelectFrom.Length)]), -1, true); Suspect.WarpIntoVehicle(SuspectCar, -1); if (!CalloutRunning) { CalloutHandler(); } return(base.OnCalloutAccepted()); }
public override bool OnCalloutAccepted() { SuspectCar = new Vehicle(TruckModels[AssortedCalloutsHandler.rnd.Next(TruckModels.Length)], SpawnPoint, SpawnHeading); SuspectCar.RandomiseLicencePlate(); SuspectCar.MakePersistent(); CarModelName = SuspectCar.Model.Name.ToLower(); CarModelName = char.ToUpper(CarModelName[0]) + CarModelName.Substring(1); try { //CarColor = SuspectCar.GetColors().PrimaryColorName + "~s~-coloured"; } catch (Exception e) { //CarColor = "weirdly-coloured"; } Suspect = SuspectCar.CreateRandomDriver(); Suspect.MakeMissionPed(); int NumberOfImmigrants = AssortedCalloutsHandler.rnd.Next(1, 5); for (int i = 0; i < NumberOfImmigrants; i++) { Game.LogTrivial("Spawning immigrant"); Ped immigrant = new Ped(ImmigrantModels[AssortedCalloutsHandler.rnd.Next(ImmigrantModels.Length)], Vector3.Zero, 0f); immigrant.MakeMissionPed(); IllegalImmigrants.Add(immigrant); immigrant.WarpIntoVehicle(SuspectCar, i + 1); Persona immigrantpersona = Functions.GetPersonaForPed(immigrant); immigrantpersona.Wanted = true; Functions.SetPersonaForPed(immigrant, immigrantpersona); } Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Illegal Immigrants in Truck", "Dispatch to ~b~" + AssortedCalloutsHandler.DivisionUnitBeat, "Citizens reporting ~r~illegal immigrants in a truck. ~b~Investigate the truck."); CalloutHandler(); return(base.OnCalloutAccepted()); }
public override bool OnCalloutAccepted() { PoliceCar = new Vehicle(CopCarModel, SpawnPoint, SpawnHeading); PoliceCar.MakePersistent(); PoliceCar.IsSirenOn = true; PoliceCar.IsSirenSilent = true; PoliceOfficer = PoliceCar.CreateRandomDriver(); PoliceOfficer.MakeMissionPed(); PoliceOfficerBlip = PoliceOfficer.AttachBlip(); PoliceOfficerBlip.Color = Color.Green; PoliceOfficerBlip.IsRouteEnabled = true; PoliceOfficer.RelationshipGroup = "PLAYER"; SuspectCar = new Vehicle(GroundVehiclesToSelectFrom[AssortedCalloutsHandler.rnd.Next(GroundVehiclesToSelectFrom.Length)], PoliceCar.GetOffsetPosition(Vector3.RelativeFront * 9f), PoliceCar.Heading); SuspectCar.MakePersistent(); Suspect = SuspectCar.CreateRandomDriver(); Suspect.MakeMissionPed(); Suspect.WarpIntoVehicle(PoliceCar, PoliceCar.PassengerCapacity - 1); Functions.SetPedAsArrested(Suspect); Suspect.Tasks.PlayAnimation("mp_arresting", "idle", 8f, AnimationFlags.UpperBodyOnly | AnimationFlags.SecondaryTask | AnimationFlags.Loop); Suspect.RelationshipGroup = "TBACKUPCRIMINAL"; MainLogic(); return(base.OnCalloutAccepted()); }
private void CalloutHandler() { CalloutRunning = true; GameFiber.StartNew(delegate { try { SuspectCar = new Vehicle(GroundVehiclesToSelectFrom[EntryPoint.rnd.Next(GroundVehiclesToSelectFrom.Length)], sp, sp); SuspectCar.IsPersistent = true; Suspect = SuspectCar.CreateRandomDriver(); Suspect.MakeMissionPed(); SuspectBritishPersona = BritishPersona.GetBritishPersona(Suspect); SuspectCarRecords = VehicleRecords.GetVehicleRecords(SuspectCar); SuspectCarRecords.RegisteredOwner = BritishPersona.GetRandomBritishPersona(); SuspectCarRecords.AddCustomFlag("~r~WANTED FOR TWOC "); Suspect.Tasks.CruiseWithVehicle(20f, VehicleDrivingFlags.DriveAroundVehicles | VehicleDrivingFlags.DriveAroundObjects | VehicleDrivingFlags.AllowMedianCrossing | VehicleDrivingFlags.YieldToCrossingPedestrians); GameFiber.Wait(2000); Game.DisplayNotification("~b~Control: ~s~TWOC report's on a ~b~" + SuspectCarRecords.CarColour + "~b~ " + SuspectCarRecords.ModelName + "~s~. Licence plate: ~b~" + SuspectCarRecords.LicencePlate + "."); GameFiber.Wait(4000); Game.DisplayNotification("Vehicle has just been taken from ~b~" + World.GetStreetName(SuspectCar.Position) + "~s~. ~b~" + SuspectCarRecords.LicencePlate + "~s~ added to ~o~ANPR system."); GameFiber.Wait(2000); Game.DisplayHelp("Locate and stop the suspect's vehicle."); HandleSearchForVehicleWithANPR(); while (CalloutRunning) { GameFiber.Yield(); if (!Game.LocalPlayer.Character.IsInAnyVehicle(false)) { break; } if (Functions.IsPlayerPerformingPullover()) { if (Functions.GetPulloverSuspect(Functions.GetCurrentPullover()) == Suspect) { break; } } } if (Functions.IsPlayerPerformingPullover()) { GameFiber.Wait(4000); } if (SuspectBlip.Exists()) { SuspectBlip.Delete(); } if ((EntryPoint.rnd.Next(11) <= 6) || (!Game.LocalPlayer.Character.IsInAnyVehicle(false))) { Pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(Pursuit, Suspect); Functions.SetPursuitIsActiveForPlayer(Pursuit, true); if (Functions.IsPlayerPerformingPullover()) { Functions.ForceEndCurrentPullover(); } Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position); Game.DisplayNotification("Control, the vehicle is ~r~making off.~b~ Giving chase."); while (Functions.IsPursuitStillRunning(Pursuit)) { GameFiber.Yield(); if (!CalloutRunning) { break; } } } else { while (CalloutRunning) { GameFiber.Yield(); if (!Game.LocalPlayer.Character.IsInAnyVehicle(false)) { GameFiber.Wait(1000); if (EntryPoint.rnd.Next(5) == 0) { Pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(Pursuit, Suspect); Functions.SetPursuitIsActiveForPlayer(Pursuit, true); if (Functions.IsPlayerPerformingPullover()) { Functions.ForceEndCurrentPullover(); } Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position); Game.DisplayNotification("Control, the vehicle is ~r~making off.~b~ Giving chase."); } break; } } while (CalloutRunning) { GameFiber.Yield(); if (Suspect.Exists()) { if (Functions.IsPedArrested(Suspect)) { break; } if (Suspect.IsDead) { break; } } else { break; } } } if (Suspect.Exists()) { if (Functions.IsPedArrested(Suspect)) { msg = "Control, suspect is ~g~under arrest. ~s~Show me state 2, over."; int HoursUnpaidWork = (int)Math.Round(((float)EntryPoint.rnd.Next(100, 200)) / 5.0f) * 5; int Costs = (int)Math.Round(((float)EntryPoint.rnd.Next(86)) / 5.0f) * 5; string sentence = " Community order made with " + HoursUnpaidWork.ToString() + " hours unpaid work. Disqualified from driving for " + EntryPoint.rnd.Next(4, 13).ToString() + " months. " + Costs.ToString() + " pounds in costs."; CourtSystem.CreateNewCourtCase(SuspectBritishPersona, "taking a vehicle without the owner's consent", 100, sentence); } else if (Suspect.IsDead) { msg = "Control, suspect is ~r~dead. ~s~Show me state 2, over"; } } else { msg = "Control, the suspects ~r~have escaped. ~s~Show me state 2, over"; } DisplayCodeFourMessage(); } catch (System.Threading.ThreadAbortException e) { End(); } catch (Exception e) { if (CalloutRunning) { Game.LogTrivial(e.ToString()); Game.LogTrivial("British Policing Script handled the exception successfully."); Game.DisplayNotification("~O~TWOC~s~ callout crashed, sorry. Please send me your log file."); Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully."); End(); } } }); }