public override void Process() { /* Archival * 2020/6/29 20:48 - Fix "InvalidHandleableException" causing whole LSPDFR to crash. * Add crash prevention system. */ base.Process(); try { if (!suspect.Exists() && !suspectCar.Exists()) { Game.LogTrivial("[Dangerous Driver/HotCallouts] Forced ending Dangerous Driver because suspect or suspect's car does not exist."); ScannerHelper.ReportNormalCode4("Dangerous Driving"); End(); return; } if (!pursuited && Functions.IsPedInPursuit(suspect)) { pursuited = true; Game.LogTrivial("[Dangerous Driver/HotCallouts] Fleeing > suspect"); ScannerHelper.DisplayDispatchDialogue("Dispatch", "suspect fleeing."); currentPursuit = Functions.GetActivePursuit(); } if (!(!pursuited || currentPursuit == null || !Functions.IsPursuitStillRunning(currentPursuit))) { pursuited = false; ScannerHelper.DisplayDispatchDialogue("Dispatch", "The pursuit has ~g~concluded~s~."); } if (Game.IsKeyDown(Keys.End)) { Game.LogTrivial("[Dangerous Driver/HotCallouts] End > Dangerous Driving"); ScannerHelper.ReportNormalCode4("Dangerous Driving"); End(); } } catch (Exception ex) { End(); Game.DisplayNotification("The callout <b>Dangerous Driver</b> was encountered error and must exit."); Game.DisplayNotification("Check log file for more details."); Game.LogTrivial("HotCallouts: exception: " + ex.GetType().Name); Game.LogTrivial("HotCallouts: message: " + ex.Message); Game.LogTrivial("HotCallouts: trace: \r\n" + ex.StackTrace); } }
public override void End() { base.End(); ScannerHelper.ReportNormalCode4("Firearm attack on officer"); if (suspect.Exists()) { if (suspectBlip.Exists()) { suspectBlip.Delete(); } if (!Functions.IsPedArrested(suspect)) { suspect.Dismiss(); } } if (officer.Exists()) { officer.Dismiss(); } }