Now I have this problem. I have this code. First, I can only hear CITIZENS_REPORT IN, without the actual name of the crime.
When I try to speak with the agent(press Y), nothing happens, even if I am close to him.
This is my code:
using System;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using Rage.Native;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Engine.Scripting.Entities;
using System.Windows.Forms;
namespace Advanced_Policer.Callouts
{
[CalloutInfo("GangActivity", CalloutProbability.Medium)]
public class GangActivity : Callout
{
public List<string> dialogWithCop = new List<string>
{
"~b~You~w~: Hello Agent! What's the situation? (1/10)",
"~b~Agent James~w~: Hello Officer! A well known gang has been spotted. (2/10)",
"~b~You~w~: Are they doing something illegal? (3/10)",
"~b~Agent James~w~: We have reasons to believe that they are going to attend to a drug deal. (4/10)",
"~b~You~w~: That's serious. Are they armed? (5/10)",
"~b~Agent James~w~: We have been informed that the gang leader is armed with a ~r~Carbine Rifle~w~. (6/10)",
"~b~You~w~: What's the plan? (7/10)",
"~b~Agent James~w~: Try to arrest the suspects. (8/10)",
"~b~You~w~: Alright! (9/10)",
"~b~Agent James~w~: Let's get this done. (10/10)",
};
public int dialogWithCopIndex;
public LHandle pursuit;
public Vector3 SpawnPoint;
public Vector3 gangLeaderSpawnPoint;
public Blip myBlip;
public Ped FBIAgent;
public Ped gangLeader;
public Ped suspect1;
public Ped suspect2;
public Ped suspect3;
public Ped suspect4;
public Ped suspect5;
public Ped suspect6;
public Ped suspect7;
public Blip gangLeaderBlip;
public ECalloutState state;
public override bool OnBeforeCalloutDisplayed()
{
gangLeaderSpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(350f));
SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(200f));
FBIAgent = new Ped("s_m_m_fiboffice_02", SpawnPoint, Game.LocalPlayer.Character.Heading + 180);
FBIAgent.BlockPermanentEvents = true;
FBIAgent.IsPersistent = true;
gangLeader = new Ped(gangLeaderSpawnPoint);
gangLeader.IsPersistent = true;
gangLeader.BlockPermanentEvents = true;
if (!FBIAgent.Exists()) return false;
this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
this.AddMinimumDistanceCheck(5f, SpawnPoint);
this.CalloutMessage = "Gang Activity";
this.CalloutPosition = SpawnPoint;
Functions.PlayScannerAudioUsingPosition("CITIZENS_REPORT GANG_TRANSIT IN_OR_ON_POSITION", this.SpawnPoint);
return base.OnBeforeCalloutDisplayed();
}
public override bool OnCalloutAccepted()
{
GameFiber.StartNew(delegate
{
myBlip = new Blip(FBIAgent);
myBlip.Color = Color.LightBlue;
myBlip.EnableRoute(Color.Yellow);
state = ECalloutState.EnRoute;
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Officer", "", "Dispatch, I'm on my way.");
GameFiber.Sleep(2500);
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Dispatch", "", "Copy that officer, report to ~b~Agent James~w~ for briefing.");
GameFiber.Sleep(2500);
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Officer", "", "10-4. Responding Code ~r~3~w~.");
});
Game.DisplaySubtitle("Speak with ~b~Agent James~w~.", 7500);
return base.OnCalloutAccepted();
}
public override void OnCalloutNotAccepted()
{
base.OnCalloutNotAccepted();
if (gangLeader.Exists()) gangLeader.Delete();
if (FBIAgent.Exists()) FBIAgent.Delete();
myBlip.Delete();
}
public override void Process()
{
base.Process();
if (Game.IsKeyDownRightNow(Keys.End))
{
EndCallout();
}
if (gangLeader.IsDead || gangLeader.IsCuffed)
{
if (suspect1.IsDead || suspect1.IsCuffed)
{
if (suspect2.IsDead || suspect2.IsCuffed)
{
if (suspect3.IsDead || suspect3.IsCuffed)
{
if (suspect4.IsDead || suspect4.IsCuffed)
{
if (suspect5.IsDead || suspect5.IsCuffed)
{
if (suspect6.IsDead || suspect6.IsCuffed)
{
if (suspect7.IsDead || suspect7.IsCuffed)
{
EndCallout();
}
}
}
}
}
}
}
}
switch (state)
{
case ECalloutState.Talking:
if (FBIAgent)
{
if (FBIAgent.IsAlive)
{
if (Game.LocalPlayer.Character.IsOnFoot)
{
if (Game.LocalPlayer.Character.DistanceTo2D(FBIAgent) <= 2)
{
if (Game.IsKeyDown(Keys.Y))
{
Game.HideHelp();
if (dialogWithCopIndex < dialogWithCop.Count)
{
Game.DisplaySubtitle(dialogWithCop[dialogWithCopIndex]);
dialogWithCopIndex++;
}
if (dialogWithCopIndex == dialogWithCop.Count)
{
suspect1 = new Ped(gangLeader.Position);
suspect2 = new Ped(gangLeader.Position);
suspect3 = new Ped(gangLeader.Position);
suspect4 = new Ped(gangLeader.Position);
suspect5 = new Ped(gangLeader.Position);
suspect6 = new Ped(gangLeader.Position);
suspect7 = new Ped(gangLeader.Position);
suspect1.IsPersistent = true;
suspect2.IsPersistent = true;
suspect3.IsPersistent = true;
suspect4.IsPersistent = true;
suspect5.IsPersistent = true;
suspect6.IsPersistent = true;
suspect7.IsPersistent = true;
suspect1.BlockPermanentEvents = true;
suspect2.BlockPermanentEvents = true;
suspect3.BlockPermanentEvents = true;
suspect4.BlockPermanentEvents = true;
suspect5.BlockPermanentEvents = true;
suspect6.BlockPermanentEvents = true;
suspect7.BlockPermanentEvents = true;
gangLeader.Inventory.GiveNewWeapon("WEAPON_CARBINERIFLE", 9999, true);
myBlip.Delete();
gangLeaderBlip = new Blip(gangLeader);
gangLeaderBlip.EnableRoute(Color.Yellow);
suspect1.RelationshipGroup = "RelSuspect";
suspect2.RelationshipGroup = "RelSuspect";
suspect3.RelationshipGroup = "RelSuspect";
suspect4.RelationshipGroup = "RelSuspect";
suspect5.RelationshipGroup = "RelSuspect";
suspect6.RelationshipGroup = "RelSuspect";
suspect7.RelationshipGroup = "RelSuspect";
Game.SetRelationshipBetweenRelationshipGroups("RelSuspect", "COP", Relationship.Hate);
suspect1.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect2.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect3.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect4.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect5.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect6.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
suspect7.Inventory.GiveNewWeapon("WEAPON_PISTOL", 9999, true);
state = ECalloutState.OnScene;
switch (state)
{
case ECalloutState.OnScene:
if(Game.LocalPlayer.Character.DistanceTo2D(gangLeader) <=10)
{
gangLeader.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect1.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect2.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect3.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect4.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect5.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect6.Tasks.FightAgainstClosestHatedTarget(1000f);
suspect7.Tasks.FightAgainstClosestHatedTarget(1000f);
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Officer", "", "I'm under fire. Requesting S.W.A.T Team Alpha!");
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "S.W.A.T Leader", "Alpha Team", "Copy that. S.W.A.T Team Alpha is en route.");
Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.SwatTeam);
Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.LocalUnit);
Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Code3, LSPD_First_Response.EBackupUnitType.LocalUnit);
}
break;
}
}
}
}
}
}
}
break;
}
}
private void EndCallout()
{
Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED");
gangLeaderBlip.Delete();
gangLeader.Dismiss();
suspect1.Dismiss();
suspect2.Dismiss();
suspect3.Dismiss();
suspect4.Dismiss();
suspect5.Dismiss();
suspect6.Dismiss();
suspect7.Dismiss();
FBIAgent.Dismiss();
Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Dispatch", "", "We are ~g~CODE 4~s~, good job officer!");
End();
}
public override void End()
{
base.End();
}
}
public enum ECalloutState
{
EnRoute,
Talking,
OnScene,
Code4
}
}