Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

API Help

Featured Replies

So I created a callout, but when I try to use the code below, the suspect blip still remains on the map.
 

        public override void Process()
        {
            base.Process();
            if (Game.IsKeyDownRightNow(System.Windows.Forms.Keys.End))
            {
                EndCallout();
            }
            if (mySuspect.IsDead || mySuspect.IsCuffed)
            {
                EndCallout();
            }
                    if (!Functions.IsPursuitStillRunning(pursuit))
                    {
                        EndCallout();
                    }
        }
        private void EndCallout()
        {
            Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED");
            Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Dispatch", "", "We are ~g~CODE 4~s~, good job officer!");
            End();
        }
        public override void End()
        {
            if (myBlip.Exists()) myBlip.Delete();
            if (mySuspect.Exists()) mySuspect.Dismiss();
            if (myVehicle.Exists()) myVehicle.Dismiss();
            base.End();
        }

 

Would need to see the rest of the code to fully confirm.

 

However my guess is for whatever reason the reference in memory to that blip is lost during the runtime of your callout, which means myBlip.Delete(); is never called because the callout doesn't think it still exists.

 

I would check what you do with the blip and whatever you attach it to (if anything) to be sure.

When in doubt debug too. Add Game.LogTrivial("stuff here"); at various points in your code and see where it goes and what happens yo your blip.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

  • Author
using System;
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;

namespace Advanced_Policer.Callouts
{
    [CalloutInfo("PursuitinProgress", CalloutProbability.Medium)]
    public class PursuitinProgress : Callout
    {
        public LHandle pursuit;
        public Vector3 SpawnPoint;
        public Blip myBlip;
        public Ped mySuspect;
        public Vehicle myVehicle;
        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(300f));
            myVehicle = new Vehicle("ZENTORNO", SpawnPoint);
            mySuspect = new Ped(SpawnPoint);
            mySuspect.WarpIntoVehicle(myVehicle, -1);
            mySuspect.IsPersistent = true;
            mySuspect.BlockPermanentEvents = true;
            myVehicle.IsPersistent = true;
            if (!mySuspect.Exists()) return false;
            this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
            this.AddMinimumDistanceCheck(5f, SpawnPoint);
            this.CalloutMessage = "Pursuit in Progress";
            this.CalloutPosition = SpawnPoint;
            Functions.PlayScannerAudioUsingPosition("OFFICERS_REPORT CRIME_RESIST_ARREST IN_OR_ON_POSITION", this.SpawnPoint);
            return base.OnBeforeCalloutDisplayed();
        }
        public override bool OnCalloutAccepted()
        {
            myBlip = mySuspect.AttachBlip();
            this.pursuit = Functions.CreatePursuit();
            Functions.AddPedToPursuit(this.pursuit, this.mySuspect);
            Functions.SetPursuitIsActiveForPlayer(this.pursuit, true);
            Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
            Game.DisplaySubtitle("Catch the ~r~suspect~w~.", 7500);
            return base.OnCalloutAccepted();
        }
        public override void OnCalloutNotAccepted()
        {
            base.OnCalloutNotAccepted();
            if (mySuspect.Exists()) mySuspect.Delete();
            myBlip.Delete();
            if (myVehicle.Exists()) myVehicle.Delete();
        }
        public override void Process()
        {
            base.Process();
            if (Game.IsKeyDownRightNow(System.Windows.Forms.Keys.End))
            {
                EndCallout();
            }
            if (mySuspect.IsDead || mySuspect.IsCuffed)
            {
                EndCallout();
            }
                    if (!Functions.IsPursuitStillRunning(pursuit))
                    {
                        EndCallout();
                    }
        }
        private void EndCallout()
        {
            Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE FOUR NO_FURTHER_UNITS_REQUIRED");
            Game.DisplayNotification("3dtextures", "mpgroundlogo_cops", "Dispatch", "", "We are ~g~CODE 4~s~, good job officer!");
            End();
        }
        public override void End()
        {
            if (myBlip.Exists()) myBlip.Delete();
            if (mySuspect.Exists()) mySuspect.Dismiss();
            if (myVehicle.Exists()) myVehicle.Dismiss();
            base.End();
        }
    }
}

 

Instead of: 

myBlip = mySuspect.AttachBlip();

 

Do this: 

myBlip = new Blip(mySuspect);

 

And by the way, it's not good practice to spawn in anything in OnBeforeCalloutDisplayed. Wait to spawn it in until OnCalloutAccepted, otherwise if the user doesn't accept the callout you're spawning in a vehicle for no reason. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

On 3/17/2020 at 10:31 AM, Xonyne88 said:

@PNWParksFan the blip still remains on the map. 

As previously advised you should add comments throughout your code, especially things like Game.LogTrivial("Blip exists:" + myblip.Exist()); as this will allow you to see in your log file where it stops existing (and therefore help figure out why it doesn't delete.

Live Streaming daily from 8pm GMT (UK) at https://twitch.tv/OfficialLukeD - I play a variety of things 😄

Join my official discord server for support, general chat and my stream schedule! https://discord.gg/Mddj7PQ

  • Author

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
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Similar Content

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.