public override void End() { if (computerPlusRunning) { // Changes the call's status to "Concluded" when the callout ends ComputerPlusFuncs.ConcludeCallout(callID); } base.End(); if (Victim.Exists()) { Victim.Tasks.Wander(); } if (SuspectBlip.Exists()) { SuspectBlip.Delete(); } if (Suspect.Exists()) { Suspect.Dismiss(); } if (Victim.Exists()) { Suspect.Dismiss(); } }
private void SituationLeavePeacefully() { GameFiber.StartNew(delegate { try { Game.DisplaySubtitle("~r~Customer~w~: Okay, okay, okay! I am leaving now dude, don't have to be rude!", 7000); karen.Tasks.PlayAnimation("cellphone@", "cellphone_photo_exit", 2f, AnimationFlags.UpperBodyOnly); GameFiber.Wait(2000); karen.Tasks.Clear(); phone.Delete(); karen.Dismiss(); //We will see if just dismissing them is enough to have them leave. GameFiber.Wait(7500); this.calloutStage = Stages.End; } catch (System.Threading.ThreadAbortException e) { Game.LogTrivial(e.ToString()); Game.LogTrivial("Social Justice Callouts handled the exception successfully."); Game.DisplayNotification("~O~Karen~s~ callout crashed, sorry. Please send me your log file <3"); Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully."); End(); } catch (Exception e) { Game.LogTrivial(e.ToString()); Game.LogTrivial("Social Justice Callouts handled the exception successfully."); Game.DisplayNotification("~O~Karen~s~ callout crashed, sorry. Please send me your log file <3"); Game.DisplayNotification("Full LSPDFR crash prevented ~g~successfully."); End(); } }); }
public override void End() { base.End(); if (caller.Exists()) { caller.Dismiss(); } if (callerBlip.Exists()) { callerBlip.Delete(); } if (SearchBlip.Exists()) { SearchBlip.Delete(); } if (suspectBlip.Exists()) { suspectBlip.Delete(); } if (suspect.Exists()) { suspect.Dismiss(); } Game.LogTrivial("RG:Cleaned up Spawned Entities"); }
/// <summary> /// All callout logic should be done here. /// </summary> public override void Process() { base.Process(); GameFiber.StartNew(delegate { { //A keys converter is used to convert a string to a key. KeysConverter kc = new KeysConverter(); //We create two variables: one is a System.Windows.Keys, the other is a string. Keys EndCalloutKey; //Use a try/catch, because reading values from files is risky: we can never be sure what we're going to get and we don't want our plugin to crash. try { //We assign myKeyBinding the value of the string read by the method getMyKeyBinding(). We then use the kc.ConvertFromString method to convert this to a key. //If the string does not represent a valid key (see .ini file for a link) an exception is thrown. That's why we need a try/catch. EndCalloutKey = (Keys)kc.ConvertFromString(getEndKey()); } //If there was an error reading the values, we set them to their defaults. We also let the user know via a notification. catch { EndCalloutKey = Keys.End; Game.DisplayNotification("There was an error reading the .ini file. Setting defaults..."); } if (Game.IsKeyDown(EndCalloutKey)) { Game.DisplayNotification("The ~y~Public Disorder~w~ is ~g~Code 4~w~."); Functions.PlayScannerAudio("WE_ARE_CODE_4 NO_FURTHER_UNITS_REQUIRED"); A1.Dismiss(); this.End(); } } }, "keyCheckerForPublicDisorder"); if (A1.IsDead) { End(); } //If the player is driving to the scene, and their distance to the scene is less than 15, start the callout's logic. if (state == EDisorderState.EnRoute && Game.LocalPlayer.Character.Position.DistanceTo(spawnPoint) <= 15) { //Set the player as on scene state = EDisorderState.OnScene; //Start the callout's logic. You can paste the logic from StartMuggingScenario straight into here, but I don't, since I like it to look clean, and place any long methods towards the bottom of the class. StartDisorderLogic(); } //If the state is DecisionMade(The aggressor already decided what random outcome to execute), and the pursuit isn't running anymore, end the callout. if (state == EDisorderState.DecisionMade && !Functions.IsPursuitStillRunning(pursuit)) { this.End(); } }
public override void Process() { base.Process(); if ((!CVDriver.Exists() || CVDriver.IsDead || Functions.IsPedArrested(CVDriver)) && (!FVBrute.Exists() || FVBrute.IsDead || Functions.IsPedArrested(FVBrute)) && (!FVDriver.Exists() || FVDriver.IsDead || Functions.IsPedArrested(FVDriver)) && (!Criminal.Exists() || Criminal.IsDead || Functions.IsPedArrested(Criminal))) { End(); } if ((!FVDriver.Exists() || FVDriver.IsDead || Functions.IsPedArrested(FVDriver)) && (!FVBrute.Exists() || FVBrute.IsDead || Functions.IsPedArrested(FVBrute)) && PursuitStarted && !Functions.IsPursuitStillRunning(Pursuit)) { End(); } if (PursuitStarted && !Functions.IsPursuitStillRunning(Pursuit) && ((FVBrute.Exists() && !FVBrute.IsDead && !Functions.IsPedArrested(FVBrute) && FVBrute.Position.DistanceTo(Game.LocalPlayer.Character.Position) > 400f) || !FVBrute.Exists() || FVBrute.IsDead || Functions.IsPedArrested(FVBrute)) && ((FVDriver.Exists() && !FVDriver.IsDead && !Functions.IsPedArrested(FVDriver) && FVDriver.Position.DistanceTo(Game.LocalPlayer.Character.Position) > 400f) || !FVDriver.Exists() || FVDriver.IsDead || Functions.IsPedArrested(FVDriver))) { End(); } if (PursuitStarted && !Functions.IsPursuitStillRunning(Pursuit)) { if (CriminalBlip.Exists()) { CriminalBlip.Delete(); } if (CVDriver.Exists()) { CVDriver.Dismiss(); } if (Criminal.Exists()) { Criminal.Dismiss(); } if (CriminalVeh.Exists()) { CriminalVeh.Dismiss(); } } if (!PursuitStarted && Game.LocalPlayer.Character.Position.DistanceTo(CVDriver.Position) < 15) { StartPursuit(); } if ((!CVDriver.Exists() || CVDriver.IsDead || Functions.IsPedArrested(CVDriver)) && CriminalBlip.Exists()) { CriminalBlip.Delete(); } if ((!FVDriver.Exists() || FVDriver.IsDead || Functions.IsPedArrested(FVDriver)) && FVDBlip.Exists()) { FVDBlip.Delete(); } if ((!FVBrute.Exists() || FVBrute.IsDead || Functions.IsPedArrested(FVBrute)) && FVBBlip.Exists()) { FVBBlip.Delete(); } }
/// <summary> /// Called when the callout ends /// </summary> public override void End() { //Dismiss the aggressor and victim, so they can be deleted by the game once the player leaves the scene. //Delete the blip attached to the aggressor if (ABlip.Exists()) { ABlip.Delete(); } Victim.Dismiss(); Aggressor.Dismiss(); base.End(); }
// More cleanup, when we end the callout you clean away anything that's left over // This is also important as this will be called if a callout gets aborted (for example if you force a new callout) public override void End() { base.End(); if (ABlip.Exists()) { ABlip.Delete(); } if (ABlip2.Exists()) { ABlip2.Delete(); } if (B1.Exists()) { B1.Delete(); } if (PedoVan.Exists()) { PedoVan.Dismiss(); } if (Aggressor.Exists()) { Aggressor.Dismiss(); } if (Aggressor2.Exists()) { Aggressor2.Dismiss(); } if (Victim.Exists()) { Victim.Delete(); } }
public override void End() { calloutState = CalloutState.End; if (Suspect.Exists()) { Suspect.Dismiss(); } if (Victim.Exists()) { Victim.Dismiss(); } if (Victim2.Exists()) { Victim2.Dismiss(); } if (SuspectVehicle.Exists()) { SuspectVehicle.Dismiss(); } if (SuspectBlip.Exists()) { SuspectBlip.Delete(); } Game.LogTrivialDebug("Raven.Clean"); base.End(); }
public override void End() { CalloutRunning = false; NativeFunction.Natives.RESET_AI_MELEE_WEAPON_DAMAGE_MODIFIER(); if (PlayerPed.Exists()) { if (PlayerPed.IsDead) { GameFiber.Wait(1500); Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE"); GameFiber.Wait(3000); } } if (CalloutFinished) { if (Passenger.Exists()) { Passenger.Dismiss(); } } else { if (Passenger.Exists()) { Passenger.Delete(); } } base.End(); }
protected void SetScriptFinished() { var value = _isImportant == true ? 100 : 50; var medal = value < 100 ? MissionPassedScreen.Medal.Silver : MissionPassedScreen.Medal.Gold; var tick = _isImportant == true ? MissionPassedScreen.TickboxState.Tick : MissionPassedScreen.TickboxState.Empty; var handler = new MissionPassedHandler("Medical Examiner", value, medal); handler.AddItem("Updated by Medical Examiner", "Details Received", MissionPassedScreen.TickboxState.Tick); handler.AddItem("Suspect Acquired", "", tick); handler.Show(); _cData.CurrentStage = CaseData.LastStage.MedicalExaminer; _cData.LastCompletedStage = CaseData.LastStage.MedicalExaminer; _cData.CompletedStages.Add(CaseData.LastStage.MedicalExaminer); _cData.SajrsUpdates.Add("Medical Examiner Report Added"); _cData.StartingStage = this.Attributes.NextScripts.FirstOrDefault(); $"Case number: {_cData.Number}".AddLog(); Serializer.SaveItemToXML(_cData, Main.CDataPath); Functions.PlayScannerAudio("ATTN_DISPATCH CODE_04_PATROL"); "Terminating L.S. Noir Callout: Sexual Assault -- Stage 2b [ME]".AddLog(); if (_me.Exists()) { _me.Dismiss(); } if (_meCar.Exists()) { _meCar.Dismiss(); } SetScriptFinished(true); }
public override void End() { if (_A1) { _A1.Dismiss(); } if (_A2) { _A2.Dismiss(); } if (_A3) { _A3.Dismiss(); } if (_CopCar1) { _CopCar1.Dismiss(); } if (_CopCar2) { _CopCar2.Dismiss(); } if (_Blip) { _Blip.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Jewelry Robbery", "~b~You: ~w~Dispatch we're code 4. Show me ~g~10-8."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); _CalloutFinished = true; base.End(); }
public override void End() { PedHelper.DeclareSubjectStatus(suspect); if (suspect.Exists()) { Game.LogTrivial("[DiamondCasinoTrouble/HotCallouts] Attmepting to dismiss suspect..."); if (!Functions.IsPedArrested(suspect)) { suspect.Dismiss(); } else { Game.LogTrivial("[DiamondCasinoTrouble/HotCallouts] Suspect was not dismissed to prevent them taking over player vehicle."); } } if (security.Exists()) { security.Dismiss(); } if (susB.Exists()) { susB.Delete(); } if (b.Exists()) { b.Delete(); } base.End(); }
public override void End() { if (calloutState == CalloutState.End) { Game.LogTrivialDebug("CalloutState = CalloutState.End Proceeding"); if (suspect.Exists()) { suspect.Dismiss(); } if (victim.Exists()) { victim.Dismiss(); } if (suspectBlip.Exists()) { suspectBlip.Delete(); } Game.LogTrivialDebug("Raven.Clean"); base.End(); } else if (calloutState != CalloutState.End) { Game.LogTrivialDebug("CalloutState does not = CalloutState.End, setting now"); calloutState = CalloutState.End; } }
public override void End() { if (_subject.Exists()) { _subject.Dismiss(); } if (_Blip.Exists()) { _Blip.Delete(); } if (_V1.Exists()) { _V1.Dismiss(); } if (_V2.Exists()) { _V2.Dismiss(); } if (_V3.Exists()) { _V3.Dismiss(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~DutchCallouts", "~y~Gepanserd Persoon", "~b~CODE 4."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); base.End(); }
public override void End() { if (suspect.Exists()) { suspect.Dismiss(); } if (locationBlip.Exists()) { locationBlip.Delete(); } // Check if ended by pressing end and delete fires; Otherwise keep them // Warning: ending the callout without deleting the fires is causing the fires to burn indefinitely if (endKeyPressed) { foreach (uint f in fireList) { //NativeFunction.CallByName<uint>("REMOVE_SCRIPT_FIRE", f); NativeFunction.Natives.RemoveScriptFire(f); } } /* * // Remove emergency services * foreach (Vehicle ev in emergencyVehicles) { * if (ev.Exists()) { ev.Dismiss(); } * } */ Functions.PlayScannerAudio("WE_ARE_CODE_4"); base.End(); Game.LogTrivial("[FireyCallouts][Log] Cleaned up 'Structural Fire' callout."); }
protected void SetScriptFinished() { "Sexual Assault Case Update".DisplayNotification("Suspect Conversation \nAdded to ~b~SAJRS", _cData.Number); _cData.CurrentStage = CaseData.LastStage.SuspectHome; _cData.LastCompletedStage = CaseData.LastStage.SuspectHome; _cData.CompletedStages.Add(CaseData.LastStage.SuspectHome); _cData.SajrsUpdates.Add("Interrogated Suspect"); _cData.WarrantAccess = true; _cData.StartingStage = this.Attributes.NextScripts.FirstOrDefault(); Serializer.SaveItemToXML <CaseData>(_cData, Main.CDataPath); var l = Serializer.LoadItemFromXML <List <ReportData> >(Main.RDataPath); l.Add(_sReportData); Serializer.SaveItemToXML(l, Main.RDataPath); if (_areaBlip.Exists()) { _areaBlip.Delete(); } if (_one) { _one.Dismiss(); } SetScriptFinished(true); }
public override void End() { if (suspect.Exists()) { suspect.Dismiss(); } if (suspectVehicle.Exists()) { suspectVehicle.Dismiss(); } if (suspectBlip.Exists()) { suspectBlip.Delete(); } /* * foreach (Vehicle ev in emergencyVehicles) { * if (ev.Exists()) { ev.Dismiss(); } * } */ Functions.PlayScannerAudio("WE_ARE_CODE_4"); base.End(); Game.LogTrivial("[FireyCallouts][Log] Cleaned up 'Plane Landing' callout."); }
protected virtual void End() { //Add gamefibers to garbage and clean eventRunning = false; if (driverBlip.Exists()) { driverBlip.Delete(); } if (!Functions.IsPlayerPerformingPullover() && !performingPullover) { if (driver.Exists() && (Functions.GetActivePursuit() == null || !Functions.GetPursuitPeds(Functions.GetActivePursuit()).Contains(driver))) { driver.Dismiss(); } if (car.Exists() && (!driver.Exists() || Functions.GetActivePursuit() == null || !Functions.GetPursuitPeds(Functions.GetActivePursuit()).Contains(driver))) { car.Dismiss(); } } else { if (TrafficPolicerHandler.IsLSPDFRPlusRunning) { API.LSPDFRPlusFunctions.AddCountToStatistic(Main.PluginName, "Traffic ambient event vehicles pulled over"); } } TrafficPolicerHandler.AmbientEventGameFibersToAbort.Add(DrivingStyleFiber); TrafficPolicerHandler.AmbientEventGameFibersToAbort.Add(AmbientEventMainFiber); Game.LogTrivial("Added ambient event fibers to cleanup"); }
/// <summary> /// More cleanup, when we call end you clean away anything left over /// This is also important as this will be called if a callout gets aborted (for example if you force a new callout) /// </summary> public override void End() { state = EWantedFelonInVehicleState.End; if (searchZoneBlip.Exists()) { searchZoneBlip.Delete(); } if (notFleeBlip.Exists()) { notFleeBlip.Delete(); } if (ped.Exists()) { ped.Dismiss(); } if (pedVehicle.Exists()) { pedVehicle.Dismiss(); } if (hasPursuitStarted) { Functions.ForceEndPursuit(pursuit); } if (heliPilot.Exists()) { heliPilot.CleanUpHeliPilot(); } base.End(); }
public override void End() { if (_AG1.Exists()) { _AG1.Dismiss(); } if (_AG2.Exists()) { _AG2.Dismiss(); } if (_V1.Exists()) { _V1.Dismiss(); } if (_V2.Exists()) { _V2.Dismiss(); } if (_V3.Exists()) { _V3.Dismiss(); } if (_V4.Exists()) { _V4.Dismiss(); } if (_SpawnLocation.Exists()) { _SpawnLocation.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~DutchCallouts", "~y~Gijzelaars", "~b~CODE 4."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); base.End(); }
public override void End() { if (_Cop.Exists()) { _Cop.Dismiss(); } if (_V.Exists()) { _V.Dismiss(); } if (_vV.Exists()) { _vV.Dismiss(); } if (_vCop.Exists()) { _vCop.Dismiss(); } if (_Blip.Exists()) { _Blip.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~DutchCallouts", "~y~Voertuig Aanhouding Assistentie", "~b~CODE 4."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); base.End(); }
public override void End() { if (_AG1) { _AG1.Dismiss(); } if (_AG2) { _AG2.Dismiss(); } if (_V1) { _V1.Dismiss(); } if (_V2) { _V2.Dismiss(); } if (_V3) { _V3.Dismiss(); } if (_V4) { _V4.Dismiss(); } if (_SpawnLocation) { _SpawnLocation.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Hostages", "~b~You: ~w~Dispatch we're code 4. Show me ~g~10-8."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); _CalloutFinished = true; base.End(); }
public override void End() { base.End(); if (Attacker.Exists()) { Attacker.Dismiss(); } if (myPed2.Exists()) { myPed2.Dismiss(); } if (myBlip.Exists()) { myBlip.Delete(); } }
public override void End() { base.End(); if (Aggressor.Exists()) { Aggressor.Dismiss(); } if (Victim.Exists()) { Victim.Dismiss(); } if (aggressorBlip.Exists()) { aggressorBlip.Delete(); } }
public override void End() { if (_subject.Exists()) { _subject.Dismiss(); } if (_V1.Exists()) { _V1.Dismiss(); } if (_V2.Exists()) { _V2.Dismiss(); } if (_V3.Exists()) { _V3.Dismiss(); } if (_Blip.Exists()) { _Blip.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~ShotsFired", "~b~You: ~w~Dispatch we're code 4. Show me ~g~10-8."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); base.End(); }
public override void End() { state = EHostageSituationState.End; if (suspect.Exists()) { suspect.Dismiss(); } if (hostage.Exists()) { hostage.Dismiss(); } if (suspectBlip.Exists()) { suspectBlip.Delete(); } if (hostageBlip.Exists()) { hostageBlip.Delete(); } if (isPursuitInitiated) { Functions.ForceEndPursuit(pursuit); } base.End(); }
public override void End() { CalloutRunning = false; 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); } } else { GameFiber.Wait(1500); Functions.PlayScannerAudio("OFFICER HAS_BEEN_FATALLY_SHOT NOISE_SHORT OFFICER_NEEDS_IMMEDIATE_ASSISTANCE"); GameFiber.Wait(3000); } if (CalloutFinished) { if (Passenger.Exists()) { Passenger.Dismiss(); } } else { if (Passenger.Exists()) { Passenger.Delete(); } } base.End(); }
public override void End() { // Deletes the blips and removes some of the stuff if (B1.Exists()) { B1.Delete(); } if (B2.Exists()) { B2.Delete(); } if (FastVehicle.Exists()) { FastVehicle.Dismiss(); } if (A1.Exists()) { A1.Dismiss(); } if (A2.Exists()) { A2.Dismiss(); } base.End(); }
public override void End() { if (_Cop) { _Cop.Dismiss(); } if (_V) { _V.Dismiss(); } if (_vV) { _vV.Dismiss(); } if (_vCop) { _vCop.Dismiss(); } if (_Blip) { _Blip.Delete(); } Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~w~UnitedCallouts", "~y~Traffic Stop Backup", "~b~You: ~w~Dispatch we're code 4. Show me ~g~10-8."); Functions.PlayScannerAudio("ATTENTION_THIS_IS_DISPATCH_HIGH WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED"); _CalloutFinished = true; base.End(); }
public override void End() { breakForceEnd = true; if (scenario == EScenario.License && ((hunter.Exists() && (hunter.IsAlive && !Functions.IsPedArrested(hunter) && !Functions.IsPedGettingArrested(hunter))) && (hunterVeh.Exists() && hunterVeh.IsAlive))) { GameFiber.StartNew(delegate { NativeFunction.Natives.TASK_GO_TO_ENTITY(hunter, hunterVeh, -1, 5.0f, 1.0f, 0, 0); while (Vector3.Distance(hunter.Position, hunterVeh.Position) > 6.0f) { GameFiber.Yield(); } hunter.Tasks.Clear(); GameFiber.Sleep(200); hunter.Tasks.EnterVehicle(hunterVeh, -1).WaitForCompletion(10000); if (hunter.IsInVehicle(hunterVeh, false)) { hunter.Tasks.CruiseWithVehicle(hunterVeh, 20.0f, VehicleDrivingFlags.Normal); } if (hunter.Exists()) { hunter.Dismiss(); } }); } else if (hunter.Exists()) { hunter.Dismiss(); } if (animalBlip.Exists()) { animalBlip.Delete(); } if (animal.Exists()) { animal.Dismiss(); } if (hunterVeh.Exists()) { hunterVeh.Dismiss(); } base.End(); }