public override void End() { CalloutRunning = false; //Rage.Native.NativeFunction.Natives.RESET_AI_MELEE_WEAPON_DAMAGE_MODIFIER() if (Game.LocalPlayer.Character.IsDead) { GameFiber.Wait(1500); Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE"); GameFiber.Wait(3000); } base.End(); if (SearchArea.Exists()) { SearchArea.Delete(); } foreach (Blip bl in SuspectBlips) { if (bl.Exists()) { bl.Delete(); } } if (CalloutFinished) { foreach (Entity ent in Suspects) { if (ent.Exists()) { ent.Dismiss(); } } foreach (Entity ent in Vehicles) { if (ent.Exists()) { ent.Dismiss(); } } } else { foreach (Entity ent in Suspects) { if (ent.Exists()) { ent.Delete(); } } foreach (Entity ent in Vehicles) { if (ent.Exists()) { ent.Delete(); } } } }
public override void End() { base.End(); CalloutRunning = false; SpeechHandler.HandlingSpeech = false; if (!CalloutFinished) { if (Shopkeeper.Exists()) { Shopkeeper.Delete(); } if (ShopkeeperBlip.Exists()) { ShopkeeperBlip.Delete(); } if (SearchArea.Exists()) { SearchArea.Delete(); } } else { if (Shopkeeper.Exists()) { Shopkeeper.Dismiss(); } if (ShopkeeperBlip.Exists()) { ShopkeeperBlip.Delete(); } if (SearchArea.Exists()) { SearchArea.Delete(); } } }
private void CalloutHandler() { CalloutRunning = true; GameFiber.StartNew(delegate { try { //Destination = World.GetNextPositionOnStreet(SpawnPoint.Around(300f)); SpawnAllEntities(); SearchArea = new Blip(Suspects[0].Position, 130f); SearchArea.Color = Color.Yellow; SearchArea.IsRouteEnabled = true; IsRouteEnabled = true; while (CalloutRunning) { GameFiber.Yield(); if (Functions.IsPlayerPerformingPullover()) { if (Suspects.Contains(Functions.GetPulloverSuspect(Functions.GetCurrentPullover()))) { break; } } foreach (Ped suspect in Suspects) { GameFiber.Yield(); if (!Game.LocalPlayer.Character.IsInAnyVehicle(false)) { if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) < 15f) { break; } } //if (Vector3.Distance(suspect.Position, Destination) < 50f) //{ // Destination = World.GetNextPositionOnStreet(Destination.Around(300f)); // Suspects[0].Tasks.DriveToPosition(Destination, 60f, VehicleDrivingFlags.Emergency).WaitForCompletion(200); //} } if (Game.LocalPlayer.Character.IsInAnyVehicle(false)) { Ped nearestsuspect = (from x in Suspects where x.DistanceTo(Game.LocalPlayer.Character.Position) < 30f select x).FirstOrDefault(); if (nearestsuspect != null) { if (Game.LocalPlayer.Character.CurrentVehicle.IsPoliceVehicle) { if (Game.LocalPlayer.Character.CurrentVehicle.IsSirenOn) { break; } } } } if (Vector3.Distance(Suspects[0].Position, SearchArea.Position) > 180f) { SearchArea.Delete(); SearchArea = new Blip(Suspects[0].Position, 110f); SearchArea.Color = Color.Yellow; SearchArea.IsRouteEnabled = IsRouteEnabled; audiocount++; if (audiocount >= 3) { Functions.PlayScannerAudioUsingPosition("SUSPECTS_LAST_REPORTED IN_OR_ON_POSITION", SearchArea.Position); audiocount = 0; } } if (IsRouteEnabled != Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f) { IsRouteEnabled = Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f; SearchArea.IsRouteEnabled = Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea.Position) > 180f; } } if (CalloutRunning) { if (ComputerPlusRunning) { API.ComputerPlusFuncs.SetCalloutStatusToAtScene(CalloutID); API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Vehicles located. In pursuit."); } GameFiber.Wait(1500); Pursuit = Functions.CreatePursuit(); foreach (Ped suspect in Suspects.ToArray()) { if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) < 150f) { Functions.AddPedToPursuit(Pursuit, suspect); if (ComputerPlusRunning) { API.ComputerPlusFuncs.AddVehicleToCallout(CalloutID, suspect.CurrentVehicle); } } else { Suspects.Remove(suspect); Vehicles.Remove(suspect.CurrentVehicle); suspect.Dismiss(); suspect.CurrentVehicle.Dismiss(); } } Functions.SetPursuitIsActiveForPlayer(Pursuit, true); Functions.ForceEndCurrentPullover(); if (SearchArea.Exists()) { SearchArea.Delete(); } Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_RESIST_ARREST IN_OR_ON_POSITION", Game.LocalPlayer.Character.Position); } while (CalloutRunning) { GameFiber.Yield(); foreach (Ped suspect in Suspects.ToArray()) { if (!suspect.Exists()) { EscapeCount++; Suspects.Remove(suspect); } else if (Functions.IsPedArrested(suspect)) { ArrestCount++; Suspects.Remove(suspect); } else if (suspect.IsDead) { DeadCount++; Suspects.Remove(suspect); } else if (Vector3.Distance(suspect.Position, Game.LocalPlayer.Character.Position) > 1000f) { EscapeCount++; Suspects.Remove(suspect); if (suspect.CurrentVehicle.Exists()) { suspect.CurrentVehicle.Delete(); } suspect.Delete(); Game.DisplayNotification("A suspect has escaped."); } } if (!Functions.IsPursuitStillRunning(Pursuit)) { break; } } DisplayCodeFourMessage(); } catch (System.Threading.ThreadAbortException e) { End(); } catch (Exception e) { if (CalloutRunning) { Game.LogTrivial(e.ToString()); Game.LogTrivial("Assorted Callouts handled the exception successfully."); Game.DisplayNotification("~O~OrganisedStreetRace~s~ callout crashed, sorry. Please send me your log file."); Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully."); End(); } } }); }
public override void End() { CalloutRunning = false; Rage.Native.NativeFunction.Natives.CLEAR_PED_NON_CREATION_AREA(); NativeFunction.Natives.SET_STORE_ENABLED(true); if (Game.LocalPlayer.Character.Exists()) { if (Game.LocalPlayer.Character.IsDead) { GameFiber.Wait(1500); Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE"); GameFiber.Wait(3000); if (ComputerPlusRunning) { API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required."); } } } else { GameFiber.Wait(1500); Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE"); GameFiber.Wait(3000); if (ComputerPlusRunning) { API.ComputerPlusFuncs.AddUpdateToCallout(CalloutID, "Officer down. Urgent assistance required."); } } base.End(); if (SearchArea.Exists()) { SearchArea.Delete(); } if (CalloutFinished) { foreach (Ped ShopKeeper in ShopKeepers) { if (ShopKeeper.Exists()) { ShopKeeper.Tasks.Clear(); ShopKeeper.IsPersistent = false; } } foreach (Ped suspect in Suspects) { if (suspect.Exists()) { Suspect.IsPersistent = false; } } foreach (Rage.Object MoneyBag in MoneyBags) { if (MoneyBag.Exists()) { MoneyBag.Detach(); MoneyBag.Dismiss(); } } if (EscapeVanDriver.Exists()) { EscapeVanDriver.IsPersistent = false; } if (EscapeVan.Exists()) { EscapeVan.Dismiss(); } } else { foreach (Ped ShopKeeper in ShopKeepers) { if (ShopKeeper.Exists()) { ShopKeeper.Delete(); } } foreach (Rage.Object MoneyBag in MoneyBags) { if (MoneyBag.Exists()) { MoneyBag.Delete(); } } foreach (Ped suspect in Suspects) { if (suspect.Exists()) { suspect.Delete(); } } if (EscapeVan.Exists()) { EscapeVan.Delete(); } if (EscapeVanDriver.Exists()) { EscapeVanDriver.Delete(); } } }
private void SituationTwo() { StolenGoodsValue = AssortedCalloutsHandler.rnd.Next(5, 500); SpawnStorePeds(); while (CalloutRunning) { GameFiber.Yield(); if (Vector3.Distance(Game.LocalPlayer.Character.Position, SearchArea) < 150f) { SearchArea.IsRouteEnabled = false; break; } } if (ComputerPlusRunning) { API.ComputerPlusFuncs.SetCalloutStatusToAtScene(CalloutID); } if (CalloutRunning) { SearchArea.Delete(); Suspects[0].Position = World.GetNextPositionOnStreet(Suspects[0].Position); Pursuit = Functions.CreatePursuit(); Functions.AddPedToPursuit(Pursuit, Suspects[0]); Functions.SetPedAsCop(Security[0]); Security[0].MakeMissionPed(); Functions.AddCopToPursuit(Pursuit, Security[0]); Functions.SetPursuitIsActiveForPlayer(Pursuit, true); Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "~b~" + ShopliftingStore.Name + " ~r~shoplifting", "Dispatch to ~b~" + AssortedCalloutsHandler.DivisionUnitBeat, "Suspect has reportedly escaped from the store and is now being chased by security. Apprehend the suspect."); Functions.PlayScannerAudioUsingPosition("WE_HAVE_01 CRIME_RESIST_ARREST IN_OR_ON_POSITION", SpawnPoint); } while (CalloutRunning) { GameFiber.Yield(); if (!Functions.IsPursuitStillRunning(Pursuit)) { GameFiber.Wait(3000); SearchArea = ShopKeepers[0].AttachBlip(); SearchArea.Color = System.Drawing.Color.Yellow; SearchArea.IsRouteEnabled = true; break; } } while (CalloutRunning) { GameFiber.Yield(); if (Vector3.Distance(Game.LocalPlayer.Character.Position, ShopKeepers[0].Position) < 4f) { if (SearchArea.Exists()) { SearchArea.IsRouteEnabled = false; SearchArea.Delete(); } Game.DisplayHelp("Press ~b~" + AssortedCalloutsHandler.kc.ConvertToString(AssortedCalloutsHandler.TalkKey) + " ~s~to talk."); if (Albo1125.Common.CommonLibrary.ExtensionMethods.IsKeyDownComputerCheck(AssortedCalloutsHandler.TalkKey)) { ShopKeepers[0].Tasks.ClearImmediately(); SpeechHandler.HandleSpeech("Shopkeeper", DetermineShopkeeperLines(), ShopKeepers[0]); GameFiber.Wait(4000); break; } } else { Game.DisplayHelp("Talk to the ~b~shopkeeper ~s~for a victim statement."); } } while (CalloutRunning) { GameFiber.Yield(); Game.DisplayHelp("Press ~b~" + AssortedCalloutsHandler.kc.ConvertToString(AssortedCalloutsHandler.EndCallKey) + " ~s~when you're done investigating."); if (Game.IsKeyDown(AssortedCalloutsHandler.EndCallKey)) { Game.HideHelp(); break; } } DisplayCodeFourMessage(); }