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.

LSPDFR Crash when accepting Callout

Featured Replies

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();
        }
    }
}

 

 

 

 

  • Author

Changed something, new code:

Spoiler

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);

            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.Position.DistanceTo(SuspectPed.Position) < 5f);
            {
                Game.IsKeyDown(System.Windows.Forms.Keys.T);
            }
            {
                Game.DisplaySubtitle("~b~Officer:~s~ Hello sir, is that your car?", 9000);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~r~Suspect:~s~ Yeah, i just wanted to leave.", 7000);
                GameFiber.Wait(7500);
                Game.DisplaySubtitle("~b~Officer:~s~ You're not going anywhere, imagine there was a crash because of your car!.", 6500);
                GameFiber.Wait(7000);
                Game.DisplaySubtitle("~r~Suspect:~s~ I don't care, i just want to leave right now ok?!", 4000);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~b~Officer:~s~ No, I guess you have to come with me to the PD!", 6500);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~b~Suspect:~s~ No, I'm leaving now, fuck you!", 3000);
                GameFiber.Wait(8000);
                Game.DisplayNotification("Arrest the ~r~suspect~s~.");
                if (Functions.IsPedArrested(SuspectPed));
                if (Functions.IsPedStoppedByPlayer(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();
            }
    }
}

 

 

Now the plugin doesn't crash anymore, but as soon as I accept the callout, the dialouge shows, but it only should when i'm near the Ped

Edited by Nicooo
Changed the Code, added description

 

 

 

 

3 hours ago, Nicooo said:

Changed something, new code:

  Reveal hidden contents

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);

            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.Position.DistanceTo(SuspectPed.Position) < 5f);
            {
                Game.IsKeyDown(System.Windows.Forms.Keys.T);
            }
            {
                Game.DisplaySubtitle("~b~Officer:~s~ Hello sir, is that your car?", 9000);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~r~Suspect:~s~ Yeah, i just wanted to leave.", 7000);
                GameFiber.Wait(7500);
                Game.DisplaySubtitle("~b~Officer:~s~ You're not going anywhere, imagine there was a crash because of your car!.", 6500);
                GameFiber.Wait(7000);
                Game.DisplaySubtitle("~r~Suspect:~s~ I don't care, i just want to leave right now ok?!", 4000);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~b~Officer:~s~ No, I guess you have to come with me to the PD!", 6500);
                GameFiber.Wait(8000);
                Game.DisplaySubtitle("~b~Suspect:~s~ No, I'm leaving now, fuck you!", 3000);
                GameFiber.Wait(8000);
                Game.DisplayNotification("Arrest the ~r~suspect~s~.");
                if (Functions.IsPedArrested(SuspectPed));
                if (Functions.IsPedStoppedByPlayer(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();
            }
    }
}

 

 

Now the plugin doesn't crash anymore, but as soon as I accept the callout, the dialouge shows, but it only should when i'm near the Ped

Then you need to use an if statement. It would be: If (game.localplayer.character.position)

and then add your suspect and the distance.

  • Author
33 minutes ago, HazyTube said:

Then you need to use an if statement. It would be: If (game.localplayer.character.position)

and then add your suspect and the distance.

I'll try it, thank you

 

 

 

 

You have a bunch of unnecessary code in there and could also use a fiber, waiting then yielding (which is compeltely unnecessary) after each subtitle isn't the best idea.

  • Author
7 minutes ago, NoNameSet said:

You have a bunch of unnecessary code in there and could also use a fiber, waiting then yielding (which is compeltely unnecessary) after each subtitle isn't the best idea.

Hi, i already changes the Gamefiber.Yield() to Gamefiber.Wait in the released callouts, thx 

10 minutes ago, NoNameSet said:

You have a bunch of unnecessary code in there and could also use a fiber, waiting then yielding (which is compeltely unnecessary) after each subtitle isn't the best idea.

Kannst auch auf Deutsch schreiben 😉

 

 

 

 

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

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.