Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Rage;
- using System;
- using System.Drawing;
- using LSPD_First_Response.Mod.API;
- using LSPD_First_Response.Mod.Callouts;
- namespace BlaineCountyCallouts.Callouts
- {
- [CalloutInfo("LS Customs - Stolen Vehicle", CalloutProbability.Medium)] // Sets the callout's info.
- class StolenVehicleLCGSD : Callout
- {
- private Ped p_Suspect; // The suspect who stole the vehicle.
- private Vehicle SuspectVehicle; // The stolen vehicle.
- private Vector3 SVLCGSDSpawnPoint; // The spawnpoint of the callout.
- private LHandle Pursuit; // The Pursuit's LHandle.
- private Blip SearchArea; // The area blip for where the player should search to find the suspect.
- private bool PursuitCreated = false; // References if pursuit has been created.
- private readonly Model[] GroundVehiclesToSelectFrom = new Model[] { "bison", "burrito3", "emperor", "emperor2", "fq2", "fugitive",
- "gresley", "habanero", "landstalker", "mesa", "patriot", "picador", "rebel", "rebel2", "regina", "sadler", "sanchez", "sandking",
- "sandking2", "seminole", "surfer", "surfer2", "tornado", "tornado2", "tornado3" }; // A list of all possible vehicles that can be spawned in as a suspect vehicle.
- private readonly string[] ResponseCodes = new string[] { "UNITS_RESPOND_CODE_03_01", "UNITS_RESPOND_CODE_03_02" }; // A list of possible "said" response codes.
- private string ChosenResponseCode; // Assigned later.
- private readonly Random rnd = new Random(); // A new random (used later).
- private readonly static Random rndSpeed = new Random(); // For random car speed.
- private readonly static Random rndEDamage = new Random(); // For random engine damage.
- private readonly float carSpeed = rndSpeed.Next(60, 150); // Sets the car speed.
- private readonly float eDamage = rndEDamage.Next(400, 1000); // Sets the car engine's damage.
- public override bool OnBeforeCalloutDisplayed()
- {
- Game.IsFullMapRevealForced = true; // Should enlarge the minimap a bit.
- SVLCGSDSpawnPoint = new Vector3(1163.482f, 2642.028f, 37.63506f); // The Spawn Point Coords.
- ShowCalloutAreaBlipBeforeAccepting(SVLCGSDSpawnPoint, 80f); // Displays the blip area before the call is accepted.
- AddMinimumDistanceCheck(20f, SVLCGSDSpawnPoint); // Creates a minimum distance check to see if the player has entered the area.
- CalloutMessage = "LS Customs Reports Stolen Vehicle"; // Should be self-explanatory. BCLSC = Blaine County Los Santos Customs.
- CalloutPosition = SVLCGSDSpawnPoint; // This two.
- ChosenResponseCode = ResponseCodes[rnd.Next(ResponseCodes.Length)]; // Chooses response code from array.
- Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_GRAND_THEFT_AUTO IN_OR_ON_POSITION" + " " + ChosenResponseCode, SVLCGSDSpawnPoint); // Plays the scanner audio.
- return base.OnBeforeCalloutDisplayed(); // Section completed.
- }
- public override bool OnCalloutAccepted()
- {
- // Vehicle Info.
- var modelName = SuspectVehicle.Model.Name;
- var vColor = SuspectVehicle.PrimaryColor.ToKnownColor();
- var licensePlateNum = SuspectVehicle.LicensePlate;
- Game.DisplayNotification("Respond Code 3! The vehicle is a " + vColor + " " + modelName + " with license plate number " + licensePlateNum);
- SearchArea = new Blip(SVLCGSDSpawnPoint, 500.0f)
- {
- Alpha = 0.5f,
- Color = Color.Yellow
- }; // Initialize the Search Area's Blip
- SearchArea.EnableRoute(Color.Yellow);
- Game.IsFullMapRevealForced = false; // Should minimize the map back to normal.
- SuspectVehicle = new Vehicle(GroundVehiclesToSelectFrom[rnd.Next(GroundVehiclesToSelectFrom.Length)], SVLCGSDSpawnPoint) // Sets the vehicle to be a random vehicle from the "GroundVehiclesToSelectFrom" array.
- {
- IsPersistent = true, // Makes the vehicle Persistent.
- EngineHealth = eDamage, // Set's the engine health.
- IsStolen = true, // Marks the vehicle as stolen.
- Heading = 352.9712f // Sets the vehicles heading.
- };
- p_Suspect = SuspectVehicle.CreateRandomDriver(); // Adds a random driver to the Suspect Vehicle.
- p_Suspect.IsPersistent = true; // Makes him/her persistent.
- p_Suspect.BlockPermanentEvents = true; // Prevents them from being distracted by world events.
- p_Suspect.Tasks.CruiseWithVehicle(carSpeed, VehicleDrivingFlags.Emergency); // Makes suspect drive eradically.
- return base.OnCalloutAccepted(); // Section completed.
- }
- public override void Process()
- {
- base.Process(); // Starts this section.
- if (Game.LocalPlayer.Character.DistanceTo(SearchArea.Position) < 250f)
- {
- SearchArea.DisableRoute(); // Disable the route.
- }
- if (!PursuitCreated && Game.LocalPlayer.Character.DistanceTo(p_Suspect.Position) < 250f) // If the pursuit is not created, and the players is 100 meters from the suspects position.
- {
- SearchArea.Delete(); // Delete the search area.
- Pursuit = Functions.CreatePursuit(); // Create a pursuit.
- Functions.AddPedToPursuit(Pursuit, p_Suspect); // Adds the suspect to the pursuit.
- Functions.SetPursuitIsActiveForPlayer(Pursuit, true); // Sets the pursuit active for the player.
- PursuitCreated = true; // Sets the bool "PursuitCreated" to true.
- }
- if (PursuitCreated && !Functions.IsPursuitStillRunning(Pursuit)) // If the pursuit has been created, and the pursuit is not still running, then:
- {
- End(); // Goto the "End()" method.
- }
- }
- public override void End()
- {
- base.End(); // Start the end base process.
- if (p_Suspect.Exists()) { p_Suspect.Dismiss(); } // If the suspect still exists, then dismiss them.
- if (SuspectVehicle.Exists()) { SuspectVehicle.Dismiss(); } // If the suspect vehicle still exists, then dismiss it.
- if (SearchArea.Exists()) { SearchArea.Delete(); } // If the search area blip still exist, then delete it.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement