As soon as I accept this callout, LSPD:FR Crashes...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LSPD_First_Response.Engine.Scripting;
using LSPD_First_Response.Engine.Scripting.Entities;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Engine;
using Rage;
using System.Diagnostics;
using Rage.Attributes;
using Rage.Native;
using System.Windows.Forms;
namespace City_Callouts.Callouts
{
[CalloutInfo("WrongParkedVehicle", CalloutProbability.High)]
public class WrongParkedVehicle : Callout
{
public Blip SuspectBlip;
public Vector3 SpawnPoint;
public Vehicle SuspectVehicle;
public Ped SuspectPed;
public Blip VehicleBlip;
public override bool OnBeforeCalloutDisplayed()
{
SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
AddMinimumDistanceCheck(20f, SpawnPoint);
CalloutMessage = "Wrong Parked Vehicle";
return base.OnBeforeCalloutDisplayed();
}
public override void OnCalloutDisplayed()
{
base.OnCalloutDisplayed();
Functions.PlayScannerAudio("WE_HAVE");
}
public override bool OnCalloutAccepted()
{
Game.DisplayHelp("Press ~r~T~s~ to begin a conversation", 7500);
Game.LocalPlayer.Character.Position.DistanceTo(SuspectPed);
SuspectPed = new Ped("a_m_m_bevhills_01", SpawnPoint, 32f);
VehicleBlip = new Blip(SpawnPoint);
SuspectVehicle = new Vehicle("Blista", SpawnPoint);
SuspectBlip = SuspectPed.AttachBlip();
SuspectBlip.IsFriendly = false;
SuspectPed.IsPersistent = true;
SuspectPed.BlockPermanentEvents = true;
return base.OnCalloutAccepted();
}
public override void Process()
{
base.Process();
if (Game.LocalPlayer.Character.DistanceTo(SuspectPed.Position) < 30f)
Game.IsKeyDown(System.Windows.Forms.Keys.T);
{
Game.DisplaySubtitle("~b~Officer:~s~ Hello sir, is that your car?", 9000);
GameFiber.Yield();
Game.DisplaySubtitle("~r~Suspect:~s~ Yeah, i just wanted to leave.", 7000);
GameFiber.Yield();
Game.DisplaySubtitle("~b~Officer:~s~ You're not going anywhere, imagine there was a crash because of your car!.", 6500);
GameFiber.Yield();
Game.DisplaySubtitle("~r~Suspect:~s~ I don't care, i just want to leave right now ok?!", 4000);
GameFiber.Yield();
Game.DisplaySubtitle("~b~Officer:~s~ No, I guess you have to come with me to the PD!", 6500);
GameFiber.Yield();
Game.DisplaySubtitle("~b~Suspect:~s~ No, I'm leaving now, fuck you!", 3000);
GameFiber.Yield();
Game.DisplayNotification("Arrest the ~r~suspect~s~.");
if (Functions.IsPedArrested(SuspectPed));
}
{
End();
}
}
public override void End()
{
base.End();
if (SuspectBlip.Exists()) SuspectBlip.Delete();
if (SuspectVehicle.Exists()) SuspectVehicle.Delete();
if (SuspectPed.Exists()) SuspectPed.Dismiss();
if (VehicleBlip.Exists()) VehicleBlip.Delete();
}
}
}