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 a little help on this one

Featured Replies

So I'm working on a "Severe Vehicle Crash" Callout, I've finished the hole thing, but when I force the callout, it says something like [("Failed to start Severe Vehicle Crash")] well something like that anyway. I think it's the OnBeforeCalloutDisplayed section of the script, because if was anything else, it would crash LSPDFR, not fail to start it. So here's what I have up to onbeforecalloutdisplayed

 

 

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;

namespace RoadIncident_Callouts.Callouts
{
    [CalloutInfo("Severe Vehicle Crash", CalloutProbability.High)]
    public class SevereVehicleCrash : Callout
    {
        public Blip PedBlip;
        public Blip SuspectBlip;
        public Blip Tooper1Blip;
        public Blip CopBlip;
        public Blip VehicleBlip;
        public Vehicle CopVehicle;
        public Vector3 SpawnPoint;
        public Vehicle SuspectVehicle;
        public EConvostate state1;
        private Vector3 CalloutPositionTrooperCar1;
        private Vector3 CalloutPositionTrooperCar2;
        public Vehicle Victimvehicle;
        public Ped Victimped;
        public Ped CopPed;
        public Ped SuspectPed;
        public Ped Trooper1;
        public Vector3 Victim1pos;
        public Vector3 CopVehicleSpawn;
        public Vector3 sp;
        public Vector3 CopPos;

        public override bool OnBeforeCalloutDisplayed()
        {
            CalloutPositionTrooperCar1 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));

            SpawnPoint.DistanceTo(CopVehicle.RearPosition);
            new SpawnPoint(0.0f, new Vector3(657.02f, -1748.54f, 29.14f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(480f));
            ShowCalloutAreaBlipBeforeAccepting(CalloutPositionTrooperCar1, 300f);
            AddMinimumDistanceCheck(20f, CalloutPositionTrooperCar1);
            CalloutMessage = "Severe Vehicle Crash";
            CalloutPositionTrooperCar1 = new Vector3(664.74f, -1748.62f, 28.66f);
            CalloutPositionTrooperCar2 = new Vector3(672.27f, -1748.53f, 28.79f);
            Victim1pos = new Vector3(672.52f, -1749.37f, 29.15f);
            CopPos = new Vector3(666.14f, -1747.15f, 29.24f);
            Functions.PlayScannerAudioUsingPosition("WE_HAVE MVA_01 UNITS_RESPOND_CODE_03_02", CalloutPositionTrooperCar1);

            return base.OnBeforeCalloutDisplayed();

2 hours ago, SRS Bladez said:

So I'm working on a "Severe Vehicle Crash" Callout, I've finished the hole thing, but when I force the callout, it says something like [("Failed to start Severe Vehicle Crash")] well something like that anyway. I think it's the OnBeforeCalloutDisplayed section of the script, because if was anything else, it would crash LSPDFR, not fail to start it. So here's what I have up to onbeforecalloutdisplayed

 

 

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;

namespace RoadIncident_Callouts.Callouts
{
    [CalloutInfo("Severe Vehicle Crash", CalloutProbability.High)]
    public class SevereVehicleCrash : Callout
    {
        public Blip PedBlip;
        public Blip SuspectBlip;
        public Blip Tooper1Blip;
        public Blip CopBlip;
        public Blip VehicleBlip;
        public Vehicle CopVehicle;
        public Vector3 SpawnPoint;
        public Vehicle SuspectVehicle;
        public EConvostate state1;
        private Vector3 CalloutPositionTrooperCar1;
        private Vector3 CalloutPositionTrooperCar2;
        public Vehicle Victimvehicle;
        public Ped Victimped;
        public Ped CopPed;
        public Ped SuspectPed;
        public Ped Trooper1;
        public Vector3 Victim1pos;
        public Vector3 CopVehicleSpawn;
        public Vector3 sp;
        public Vector3 CopPos;

        public override bool OnBeforeCalloutDisplayed()
        {
            CalloutPositionTrooperCar1 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));

            SpawnPoint.DistanceTo(CopVehicle.RearPosition);
            new SpawnPoint(0.0f, new Vector3(657.02f, -1748.54f, 29.14f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(480f));
            ShowCalloutAreaBlipBeforeAccepting(CalloutPositionTrooperCar1, 300f);
            AddMinimumDistanceCheck(20f, CalloutPositionTrooperCar1);
            CalloutMessage = "Severe Vehicle Crash";
            CalloutPositionTrooperCar1 = new Vector3(664.74f, -1748.62f, 28.66f);
            CalloutPositionTrooperCar2 = new Vector3(672.27f, -1748.53f, 28.79f);
            Victim1pos = new Vector3(672.52f, -1749.37f, 29.15f);
            CopPos = new Vector3(666.14f, -1747.15f, 29.24f);
            Functions.PlayScannerAudioUsingPosition("WE_HAVE MVA_01 UNITS_RESPOND_CODE_03_02", CalloutPositionTrooperCar1);

            return base.OnBeforeCalloutDisplayed();

Am I right in saying you have ended the OnBeforeCalloutDisplayed() part with a closed bracketas it's not visible on there?

  • Author

No, there is a closed bracket under it, it looks like this

 

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;

namespace RoadIncident_Callouts.Callouts
{
    [CalloutInfo("Severe Vehicle Crash", CalloutProbability.High)]
    public class SevereVehicleCrash : Callout
    {
        public Blip PedBlip;
        public Blip SuspectBlip;
        public Blip Tooper1Blip;
        public Blip CopBlip;
        public Blip VehicleBlip;
        public Vehicle CopVehicle;
        public Vector3 SpawnPoint;
        public Vehicle SuspectVehicle;
        public EConvostate state1;
        private Vector3 CalloutPositionTrooperCar1;
        private Vector3 CalloutPositionTrooperCar2;
        public Vehicle Victimvehicle;
        public Ped Victimped;
        public Ped CopPed;
        public Ped SuspectPed;
        public Ped Trooper1;
        public Vector3 Victim1pos;
        public Vector3 CopVehicleSpawn;
        public Vector3 sp;
        public Vector3 CopPos;

        public override bool OnBeforeCalloutDisplayed()
        {
            CalloutPositionTrooperCar1 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));

            SpawnPoint.DistanceTo(CopVehicle.RearPosition);
            new SpawnPoint(0.0f, new Vector3(657.02f, -1748.54f, 29.14f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(480f));
            ShowCalloutAreaBlipBeforeAccepting(CalloutPositionTrooperCar1, 300f);
            AddMinimumDistanceCheck(20f, CalloutPositionTrooperCar1);
            CalloutMessage = "Severe Vehicle Crash";
            CalloutPositionTrooperCar1 = new Vector3(664.74f, -1748.62f, 28.66f);
            CalloutPositionTrooperCar2 = new Vector3(672.27f, -1748.53f, 28.79f);
            Victim1pos = new Vector3(672.52f, -1749.37f, 29.15f);
            CopPos = new Vector3(666.14f, -1747.15f, 29.24f);
            Functions.PlayScannerAudio("WE_HAVE MVA_03 UNITS_RESPOND_CODE_03_02");

            return base.OnBeforeCalloutDisplayed();
        }

are you in the radius of your distance check while accepting the callout?

Don't play scanner audio in OnBeforeCalloutDisplayed, play it in OnCalloutDisplayed. Also you have some lines which aren't doing anything like the GetNextPositionOnStreet calls which don't assign to anything, and you have some hard-coded positions but also some dynamic positions. 

 

Note as well that OnCalloutDisplayed and IIRC even OnCalloutAccepted return bools as well. If any of them returns false, the callout won't run. 

 

You also need to register the callout when your plugin loads. 

[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!

  • Author

This is what I've got (doesn't work)

 

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;

namespace RoadIncident_Callouts.Callouts
{
    [CalloutInfo("Severe Vehicle Crash", CalloutProbability.High)]
    public class SevereVehicleCrash : Callout
    {
        public Blip PedBlip;
        public Blip SuspectBlip;
        public Blip Tooper1Blip;
        public Blip CopBlip;
        public Blip VehicleBlip;
        public Vehicle CopVehicle;
        public Vector3 SpawnPoint;
        public Vehicle SuspectVehicle;
        public EConvostate state1;
        private Vector3 CalloutPositionTrooperCar1;
        private Vector3 CalloutPositionTrooperCar2;
        public Vehicle Victimvehicle;
        public Ped Victimped;
        public Ped CopPed;
        public Ped SuspectPed;
        public Ped Trooper1;
        public Vector3 Victim1pos;
        public Vector3 CopVehicleSpawn;
        public Vector3 sp;
        public Vector3 CopPos;

        public override bool OnBeforeCalloutDisplayed()
        {
            CalloutPositionTrooperCar1 = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
            SpawnPoint.DistanceTo(CopVehicle.RearPosition);
            new SpawnPoint(0.0f, new Vector3(657.02f, -1748.54f, 29.14f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(700f));
            World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(480f));
            ShowCalloutAreaBlipBeforeAccepting(CalloutPositionTrooperCar1, 300f);
            AddMinimumDistanceCheck(20f, CalloutPositionTrooperCar1);
            CalloutMessage = "Severe Vehicle Crash";
            CalloutPositionTrooperCar1 = new Vector3(664.74f, -1748.62f, 28.66f);
            CalloutPositionTrooperCar2 = new Vector3(672.27f, -1748.53f, 28.79f);
            Victim1pos = new Vector3(672.52f, -1749.37f, 29.15f);
            CopPos = new Vector3(666.14f, -1747.15f, 29.24f);

            return base.OnBeforeCalloutDisplayed();
        }
        public override void OnCalloutDisplayed()
        {
            base.OnCalloutDisplayed();
            Functions.PlayScannerAudio("WE_HAVE MVA_03 UNITS_RESPOND_CODE_03_02");
        }
        public override bool OnCalloutAccepted()
        {
            Game.DisplaySubtitle("Go to the scene and speak with the ~b~officer.~s~", 7500);
            CopVehicleSpawn = CopVehicle.RearPosition;
            CopVehicle = new Vehicle("Police", CalloutPositionTrooperCar1, 306.05f)
            {
                IsPersistent = true
            };

            Victimvehicle = new Vehicle("Fugitive", CalloutPositionTrooperCar2, 306.05f);

            Victimped = new Ped("a_m_m_bevhills_01", Victim1pos, 672.15f);
            VehicleBlip = new Blip(CalloutPositionTrooperCar1)
            {
                IsRouteEnabled = true
            };
            Victimped.IsPersistent = true;
            Victimped.BlockPermanentEvents = true;
            CopPed = new Ped("s_m_y_cop_01", CopPos, 666.14f);
            CopBlip = new Blip(CopPos);
            CopPed.IsPersistent = true;
            CopPed.BlockPermanentEvents = true;

            return base.OnCalloutAccepted();
        }
        public override void Process()
        {
            base.Process();
            if (Game.LocalPlayer.Character.Position.DistanceTo(CopPed.Position) <= 10f)
                GameFiber.Yield();
            while (Game.IsKeyDown(System.Windows.Forms.Keys.Y))
                GameFiber.Yield();
            VehicleBlip.DisableRoute();

            Game.DisplaySubtitle("~b~Officer:~s~ I saw the two vehicles crash as I was driving the other way, the ~g~victim~s~ seems to be alright, but the ~r~suspect~s~ is very aggressive, so be careful of him.", 9000);
            GameFiber.Wait(8000);
            Game.DisplaySubtitle("~b~Officer~s~ I've spoken to both of them, and they seem friendly towards each other but the suspect doesn't like me at all", 7000);
            GameFiber.Wait(6000);
            Game.DisplaySubtitle("~b~Officer:~s~ So now that you know what's going on, talk to the ~g~victim~s~ first, and then tlak to the ~r~suspect~s~.", 6500);
            if (Game.LocalPlayer.Character.Position.DistanceTo(Victimped.Position) <= 10f)
                GameFiber.Yield();
            while (Game.IsKeyDown(System.Windows.Forms.Keys.Y))
                GameFiber.Yield();
            Game.DisplaySubtitle("~b~You:~s~ Hello Sir, I'm here to talk to you about the crash.", 4000);
            GameFiber.Wait(3000);
            Game.DisplaySubtitle("~g~Victim:~s~ Hello Officer, yes... This man was doing well over the speed limit, came up behind me and next thing ya know, BOOM! ploughed into my fucking car!", 6500);
            GameFiber.Wait(5500);
            Game.DisplaySubtitle("~b~You:~s~ Why isn't the suspect's vehicle here sir?", 3000);
            GameFiber.Wait(2000);
            Game.DisplaySubtitle("~g~Victim:~s~ The officer first on scene searched it, and got it towed away. I didn't really pay attention to that because I could care less what happens to that asshole.", 8000);
            GameFiber.Wait(7000);
            Game.DisplaySubtitle("~b~You:~s~ Are you hurt in anyway? Is anything bothering you?", 3500);
            GameFiber.Wait(2500);
            Game.DisplaySubtitle("~g~Victim:~s~ No sir, I just want that asshole put in prison for how he's treated the officer, hitting my car and then acting like he's done nothing wrong... Fucking idiot!", 7000);
            GameFiber.Wait(6000);
            Game.DisplaySubtitle("~b~You:~s~ Alright sir, I'll talk to him now.", 3000);
            GameFiber.Wait(2000);
            Game.DisplaySubtitle("~g~Victim:~s~ Thank you officer.", 2500);
            GameFiber.Wait(1500);
            Game.DisplaySubtitle("Talk to the ~r~suspect~s~ and deal with the situation how you think it fits.", 4000);
            if (Game.LocalPlayer.Character.Position.DistanceTo(SuspectPed) <= 10f)
                GameFiber.Yield();
            while (Game.IsKeyDown(System.Windows.Forms.Keys.Y))
                GameFiber.Yield();
            Game.DisplaySubtitle("~b~You:~s~ Hello Sir, I'm to talk with you about the crash.", 3500);
            GameFiber.Wait(2500);
            Game.DisplaySubtitle("~r~Suspect:~s~ I'm not saying one fucking word dumbass, I've done nothing wrong, he should be dead for all I care, now fuck off and leave me alone!", 6500);
            GameFiber.Wait(5500);
            Game.DisplayNotification("Arrest the ~r~suspect~s~.");
            if (Functions.IsPedArrested(SuspectPed))
            {
                End();
            }
        }
        public override void End()
        {
            base.End();
            if (Victimped.Exists()) Victimped.Dismiss();
            if (Victimvehicle.Exists()) Victimvehicle.Dismiss();
            if (SuspectBlip.Exists()) SuspectBlip.Delete();
            if (SuspectVehicle.Exists()) SuspectVehicle.Delete();
            if (SuspectPed.Exists()) SuspectPed.Dismiss();
            if (CopBlip.Exists()) CopBlip.Delete();
            if (CopPed.Exists()) CopPed.Dismiss();
            if (CopVehicle.Exists()) CopVehicle.Delete();
        }
    }
}
   
                    
                
            
        
    

                 
                
                
            
        
    

        
                
                
                            
        
    

Edited by SRS Bladez

  • Author

:EDITED: I fixed it, thank you guys for the help, I just had to reigster the callout. Such a simple mistake that I forgot to do. I'm just wondering how to make a police vehicle's lights on with no siren (DON't WORRY I DID IT) All I had to do is CopVehicle.IsSirenOn = true;

Edited by SRS Bladez

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.