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.

I need help with my callout

Featured Replies

Hi i have made an callout with one crime scene so far its an pursuit running away from the police it spawns and stuff but when im close to the pursuit i get 14 fps and later my lspdfr game crashes

 

Any suggistions?

On 11/19/2023 at 9:00 PM, Peteres said:

when im close to the pursuit i get 14 fps

@RicyVasco is 100% correct -We cant guess your bug -Show code!
You have already understood where in your scenario your code has an issue. The debug process is then to study what your code does at that event
You can get debug info written in your log with the statement
 

Game.LogTrivial(" blah "+>any var in your event<);

ofcause without the ><

 

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

  • Community Team
On 11/19/2023 at 1:00 PM, Peteres said:

Hi i have made an callout with one crime scene so far its an pursuit running away from the police it spawns and stuff but when im close to the pursuit i get 14 fps and later my lspdfr game crashes

 

Any suggistions?


No idea without code but im willing to bet you're creating the pursuit in process() so its just spamming that poor thing lol

  • 1 month later...
  • Author

how do i show my code then?

 

after that is solved i may need help with something else

 

Edited by Peteres

2 hours ago, Peteres said:

how do i show my code then?

..just copy the C# source-text in full or if you know where the issue is; in except -of your main from your IDE and paste it here

 

(You are using the example-plugin template -right?)

-If you dont want to make your source public you can send it as PM, but ..
 

Edited by GTAbear
added new info

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

  • Author
Spoiler

using System;
using Rage;
using Rage.Native;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Engine.Scripting.Entities;
using LSPD_First_Response.Engine;

namespace SwedishCallouts.Callouts
{
    [CalloutInfo("Terrordåd", CalloutProbability.Low)]
    class Terrordåd : Callout
    {
        public LHandle pursuit;
        public Vector3 SpawnPoint;
        public Blip myBlip;
        public Ped mySuspect;
        public Vehicle myVehicle;

        public override bool OnBeforeCalloutDisplayed()
        {
            //Get a valid spawnpoint for the callout.
            new SpawnPoint(96.22984f, new Vector3(-1293.536f, -680.847f, 25.092f));

            //Create a list of VehicleModels to get them randomly generated.
            Model[] VehicleModels = new Model[]
            {
                "POUNDER"
            };

            //Choose a random vehicle model for myVehicle by using the models we listed above, and spawn it at SpawnPoint.
            myVehicle = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPoint);

            //Set myVehicle as persistent, so it doesn't randomly disappear.
            myVehicle.IsPersistent = true;

            //Spawn mySuspect at SpawnPoint.
            mySuspect = new Ped(SpawnPoint);

            //Warp mySuspect into myVehicle, -1 represents the drivers seat.
            mySuspect.WarpIntoVehicle(myVehicle, -1);

            //Set mySuspect as persistent, so it doesn't randomly disappear.
            mySuspect.IsPersistent = true;

            //Block permanent events from mySuspect so they don't react weirdly to different things from GTA V.
            mySuspect.BlockPermanentEvents = true;

            //If for some reason, the spawning of mySuspect failed, don't display the callout.
            if (!mySuspect.Exists()) return false;

            //If the peds are valid, display the area that the callout is in.
            this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
            this.AddMinimumDistanceCheck(5f, SpawnPoint);

            //Set the callout message(displayed in the notification), and the position(also shown in the notification)
            this.CalloutMessage = "Terrordåd på Drottninggatan";
            this.CalloutPosition = SpawnPoint;

            //Play the scanner audio using SpawnPoint to identify "POSITION" stated in "IN_OR_ON_POSITION". These audio files can be found in GTA V > LSPDFR > Police Scanner.
            Functions.PlayScannerAudioUsingPosition("VEHICLE_CATEGORY_TRUCK_01 IN_OR_ON_POSITION", this.SpawnPoint);

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted()
        {
            //Attach myBlip to mySuspect to show where they are.
            myBlip = mySuspect.AttachBlip();

            //Display a message to let the user know what to do.
            Game.DisplaySubtitle("Försök stoppa gärningsmannen.", 7500);

            return base.OnCalloutAccepted();
        }

        public override void OnCalloutNotAccepted()
        {
            base.OnCalloutNotAccepted();

            //Clean up what we spawned earlier, since the player didn't accept the callout.

            //This states that if mySuspect exists, then we need to delete it.
            if (mySuspect.Exists()) mySuspect.Delete();

            //This states that if myBlip exists, then we need to delete it.
            if (myBlip.Exists()) myBlip.Delete();
        }

        public override void Process()
        {
            base.Process();
            {
                //This states that if the player is less than or equal to 100 meters away from SpawnPoint, then it will do whatever is in the brackets.
                if (Game.LocalPlayer.Character.Position.DistanceTo(SpawnPoint) <= 100f)
                {
                    //Create the pursuit.
                    this.pursuit = Functions.CreatePursuit();

                    //Add mySuspect to the pursuit.
                    Functions.AddPedToPursuit(this.pursuit, mySuspect);

                    //Request Backup for an air unit and one local unit to join into the pursuit.
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                }
            }
        }

        public override void End()
        {
            //Dismiss mySuspect, so it can be deleted by the game once the player leaves the scene.
            //Delete myBlip, so it doesn't stick around on the minimap annoying the player.

            //This states that if mySuspect exists, then we need to dismiss it.
            if (mySuspect.Exists()) mySuspect.Dismiss();

            //Delete the blip attached to mySuspect.
            if (myBlip.Exists()) myBlip.Delete();

            base.End();
        }

    }
}

is it this?

6 hours ago, Peteres said:

is it this?

Yes and Always only use UNI-code-letters when you write code! Never use nordic-letters (ä ö å), they will cause problems!
So like 'Terrordåd' should be TerrorAct

-UNI-code-letters are those used in english + numbers -Only use that in actual code!

 

Here are some other ..pointers

I write in capitals for you to better see the text.

 

Spoiler

using System;
using Rage;
using Rage.Native;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Engine.Scripting.Entities;
using LSPD_First_Response.Engine;

namespace SwedishCallouts.Callouts
{
    [CalloutInfo("Terrordåd", CalloutProbability.Low)]
    class Terrordåd : Callout//NO! DONT USE ä
    {
        public LHandle pursuit;
        public Vector3 SpawnPoint;
        public Blip myBlip; //DONT USE IDIOCRATIC-NAMES. USE DESCRIPTIVE NAMES LIKE
        //public Blip terroristBlip;
        public Ped mySuspect; //DONT USE IDIOCRATIC-NAMES.
        public Vehicle myVehicle; //DONT USE IDIOCRATIC-NAMES.

        public override bool OnBeforeCalloutDisplayed()
        {
            //Get a valid spawnpoint for the callout.
            new SpawnPoint(96.22984f, new Vector3(-1293.536f, -680.847f, 25.092f));

            //Create a list of VehicleModels to get them randomly generated.
            Model[] VehicleModels = new Model[] //YoU ARE MAKING A COLLECTION, BUT ONLY WITH ONE MEMBER. THE REASON FOR THE COLLECTION IS THAT YOU CAN USE SEVERAL VEHICLES AND ONE WILL BE CHOSEN BY GAME ENGINE
            //SO YOUR ARRAY VehicleModels SHOULD AT MINIMUM HAVE TWO MEMBERS, OTHERWISE IT IS REDUNDANT
            {
                "POUNDER"
            };

            //Choose a  !  random  !    vehicle model for myVehicle by using the models we listed above, and spawn it at SpawnPoint.
            myVehicle = new Vehicle(VehicleModels[new Random().Next(VehicleModels.Length)], SpawnPoint);

            //Set myVehicle as persistent, so it doesn't randomly disappear.
            myVehicle.IsPersistent = true;

            //Spawn mySuspect at SpawnPoint.
            mySuspect = new Ped(SpawnPoint);

            //Warp mySuspect into myVehicle, -1 represents the drivers seat.
            mySuspect.WarpIntoVehicle(myVehicle, -1);

            //Set mySuspect as persistent, so it doesn't randomly disappear.
            mySuspect.IsPersistent = true;

            //Block permanent events from mySuspect so they don't react weirdly to different things from GTA V.
            mySuspect.BlockPermanentEvents = true;

            //If for some reason, the spawning of mySuspect failed, don't display the callout.
            if (!mySuspect.Exists()) return false;

            //If the peds are valid, display the area that the callout is in.
            this.ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 15f);
            this.AddMinimumDistanceCheck(5f, SpawnPoint);

            //Set the callout message(displayed in the notification), and the position(also shown in the notification)
            this.CalloutMessage = "Terrordåd på Drottninggatan";
            this.CalloutPosition = SpawnPoint;

            //Play the scanner audio using SpawnPoint to identify "POSITION" stated in "IN_OR_ON_POSITION". These audio files can be found in GTA V > LSPDFR > Police Scanner.
            Functions.PlayScannerAudioUsingPosition("VEHICLE_CATEGORY_TRUCK_01 IN_OR_ON_POSITION", this.SpawnPoint);

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted()
        {
            //Attach myBlip to mySuspect to show where they are.
            myBlip = mySuspect.AttachBlip();

            //Display a message to let the user know what to do.
            Game.DisplaySubtitle("Försök stoppa gärningsmannen.", 7500);

            return base.OnCalloutAccepted();
        }

        public override void OnCalloutNotAccepted()
        {
            base.OnCalloutNotAccepted();

            //Clean up what we spawned earlier, since the player didn't accept the callout.

            //This states that if mySuspect exists, then we need to delete it.
            if (mySuspect.Exists()) mySuspect.Delete();

            //This states that if myBlip exists, then we need to delete it.
            if (myBlip.Exists()) myBlip.Delete();
        }

        public override void Process()
        {
            base.Process();
            {
                //This states that if the player is less than or equal to 100 meters away from SpawnPoint, then it will do whatever is in the brackets.
                if (Game.LocalPlayer.Character.Position.DistanceTo(SpawnPoint) <= 100f)
                {
                    //Create the pursuit.
                    this.pursuit = Functions.CreatePursuit();

                    //Add mySuspect to the pursuit.
                    Functions.AddPedToPursuit(this.pursuit, mySuspect);

                    //Request Backup for an air unit and one local unit to join into the pursuit.
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                }
            }
        }

        public override void End()
        {
            //Dismiss mySuspect, so it can be deleted by the game once the player leaves the scene.
            //Delete myBlip, so it doesn't stick around on the minimap annoying the player.

            //This states that if mySuspect exists, then we need to dismiss it.
            if (mySuspect.Exists()) mySuspect.Dismiss();

            //Delete the blip attached to mySuspect.
            if (myBlip.Exists()) myBlip.Delete();

            base.End();
        }

    }
}

 

Try that
If it works -great! but if it fails we need to see content of your Main file as well

 

---

Also just made this


May be useful if you not already know about them

Edited by GTAbear
added new info

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

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.