/// <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(); }
/// <summary> /// If you don't accept the callout this will be called, we clear anything we spawned here to prevent it staying in the game /// </summary> public override void OnCalloutNotAccepted() { state = EWantedFelonInVehicleState.End; if (ped.Exists()) { ped.Delete(); } if (pedVehicle.Exists()) { pedVehicle.Delete(); } if (searchZoneBlip.Exists()) { searchZoneBlip.Delete(); } if (notFleeBlip.Exists()) { notFleeBlip.Delete(); } if (heliPilot.Exists()) { heliPilot.CleanUpHeliPilot(); } base.OnCalloutNotAccepted(); }
/// <summary> /// OnCalloutAccepted is where we begin our callout's logic. In this instance we create our pursuit and add our ped from eariler to the pursuit as well /// </summary> /// <returns></returns> public override bool OnCalloutAccepted() { //We accepted the callout, so lets initilize our blip from before and attach it to our ped so we know where he is. searchZoneBlip = new Blip(ped.Position, 320.0f); searchZoneBlip.Color = Color.FromArgb(100, Color.Yellow); //Game.SetRelationshipBetweenRelationshipGroups(ped.RelationshipGroup, "COP", Relationship.Dislike); //Game.SetRelationshipBetweenRelationshipGroups(ped.RelationshipGroup, "PLAYER", Relationship.Dislike); state = EWantedFelonInVehicleState.Searching; GameFiber.StartNew(delegate { Vector3 position = ped.Position; Game.DisplayNotification("~b~Dispatch: ~w~Suspect last seen in a ~b~" + pedVehicle.Model.Name + "~w~, color ~b~" + pedVehicle.GetPrimaryColor().ToFriendlyName().ToLower()); Game.DisplayNotification("~b~Dispatch: ~w~At ~b~" + position.GetStreetName() + "~w~, in ~b~" + position.GetZoneName() + "~w~, ~b~" + position.GetAreaName()); Game.DisplayNotification("~b~Dispatch: ~w~Air unit deployed"); GameFiber.Wait(Globals.Random.Next(1250, 2750)); Game.DisplayNotification("~b~" + Settings.General.Name + ": ~w~10-4"); }); UpdateSearchArea(); return(base.OnCalloutAccepted()); }
//This is where it all happens, run all of your callouts logic here public override void Process() { if (ped.Exists() && Vector3.Distance(Game.LocalPlayer.Character.Position, ped.Position) < 17.5f && state == EWantedFelonInVehicleState.Searching) { state = EWantedFelonInVehicleState.Found; SuspectFound(); } if (state == EWantedFelonInVehicleState.Found) { if (ped.Exists() && shouldAttack && !ped.IsInAnyVehicle(false) && !Functions.IsPedGettingArrested(ped) && !Functions.IsPedArrested(ped)) { ped.AttackPed(Game.LocalPlayer.Character); } } base.Process(); if (!ped.Exists() || ped.IsDead || Functions.IsPedArrested(ped)) { this.End(); } }