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.

Mega Help Me Post! - Multiple Issues And Questions

Featured Replies

Hi All,

 

I have stated work on a new plugin for LSPDFR. The idea is that the player will play as a detective and respond to callouts that real life detectives would go to. However I have ran into some issues that I need help with.

 

Firstly, when I spawn a callout using CalloutManager I will accept the callout then it will disappear with the message "Disregard". I have looked into this using other fixes but none of them work.

 

The first Spoiler is my Main.cs and the second the callout "FleeingFromCrimeScene.cs". Can you have a look for me?

 

Spoiler

Main.cs

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LSPD_First_Response.Mod.API;
using Rage;
namespace Detective_Callouts
{
    public class Main : Plugin
    {
        public override void Initialize()
        {
            Functions.OnOnDutyStateChanged += OnOnDutyStateChangedHandler;
            Game.LogTrivial("Plugin =" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString() + " By Harry Catraz Has Been Initialised");
            Game.LogTrivial("Go on duty to start the callouts");
        }
        public override void Finally()
        {
            Game.LogTrivial("Clean Up Script = Detective Callouts = Cleaned");
        }
        private static void OnOnDutyStateChangedHandler(bool OnDuty)
        {
            if (OnDuty)
            {
                RegisterCallouts();
            }
        }
        private static void RegisterCallouts()
        {
            Functions.RegisterCallout(typeof(Callouts.FleeingFromCrimeScene));
            Functions.RegisterCallout(typeof(Callouts.ContaminatingEvidence));
            Functions.RegisterCallout(typeof(Callouts.CrimeSeenNeedsInvestigating));
        }
    }
}

 

Spoiler

Callout  "FleeingFromCrimeScene.cs"

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Rage;
using LSPD_First_Response.Mod.API;
using LSPD_First_Response.Mod.Callouts;
using LSPD_First_Response.Engine.Scripting.Entities;
namespace Detective_Callouts.Callouts
{
    [CalloutInfo("Fleeing From Crime Scene", CalloutProbability.VeryHigh)]
    public class FleeingFromCrimeScene : Callout
    {
        private Ped Suspect;
        private Vehicle SuspectVehicle;
        private Vector3 SpawnPoint;
        private Blip SuspectBlip;
        private LHandle Pursuit;
        private bool PursuitCreated = true;
        public override bool OnBeforeCalloutDisplayed()
        {
            SpawnPoint = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(350f));
            ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
            AddMinimumDistanceCheck(50f, SpawnPoint);
            AddMinimumDistanceCheck(350f, SpawnPoint);
            CalloutMessage = "Fleeing From Crime Scene";
            CalloutPosition = SpawnPoint;
            Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_OFFICER_IN_NEED_OF_ASSISTANCE_01 IN_OR_ON_POSITION UNITS_RESPOND_CODE_03_01", SpawnPoint);
            return base.OnBeforeCalloutDisplayed();
        }
        public override bool OnCalloutAccepted()
        {
            SuspectVehicle = new Vehicle("JACKAL", SpawnPoint);
            SuspectVehicle.IsPersistent = true;
            Suspect = SuspectVehicle.CreateRandomDriver();
            Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;
            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.IsFriendly = false;
            Suspect.Tasks.CruiseWithVehicle(27f, VehicleDrivingFlags.Emergency);
            return base.OnCalloutAccepted();
        }
        public override void Process()
        {
            base.Process();
            if (!PursuitCreated && Game.LocalPlayer.Character.DistanceTo(Suspect.Position) < 500f)
            {
                Pursuit = Functions.CreatePursuit();
                Functions.AddPedToPursuit(Pursuit, Suspect);
                Functions.SetPursuitIsActiveForPlayer(Pursuit, true);
                Game.DisplaySubtitle("Detain The Arrest The Suspect");
                PursuitCreated = true;
            }
            if (PursuitCreated && !Functions.IsPursuitStillRunning(Pursuit))
            {
                End();
            }
        }
        public override void End()
        {
            base.End();
            if (Suspect.Exists())
            {
                Suspect.Dismiss();
            }
            if (SuspectVehicle.Exists())
            {
                SuspectVehicle.Dismiss();
            }
            if (SuspectBlip.Exists())
            {
                SuspectBlip.Delete();
            }
        }
    }
}

Secondly I am making a built in callout manger into my plugin and have ran into some issues. I want it to spawn the callout the player has the box on when the "Confim" button is pressed. Here is what I have so far. The issue is that I don't know what to put in the if statement at the bottom.

 

Furthermore, the line "CalloutList = new UIMenuListItem("Callouts", Callouts, 0);" has a green line underneath that indicates an error that I cant seem to fix. Can oyu see the issue?

Here is the EntryPoint.cs

Spoiler

EntryPoint.cs

 

using Rage;
using RAGENativeUI;
using RAGENativeUI.Elements;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
[assembly: Rage.Attributes.Plugin("Detective Callouts Menu", Description = "The Menu Required For Detective Callouts", Author = "Harry Catraz")]
namespace Detective_Callouts
{
    public static class EntryPoint
    {
        private static UIMenu MainMenu;
        private static UIMenu CalloutCreator;
        private static MenuPool _menuPool;
        private static UIMenuItem navigateToCalloutCreatorItem;
        private static UIMenuListItem CalloutList;
        private static UIMenuItem ConfirmItem;
        public static void Main()
        {
            _menuPool = new MenuPool();
            MainMenu = new UIMenu("Detective Callouts Menu", "Detective Callouts");
            _menuPool.Add(MainMenu);
            CalloutCreator = new UIMenu("Callout Creator", "Spawn Detective Callouts");
            _menuPool.Add(CalloutCreator);
            CalloutCreator.SetMenuWidthOffset(30);
            MainMenu.SetMenuWidthOffset(30);
            MainMenu.AddItem(navigateToCalloutCreatorItem = new UIMenuItem("Callout Creator"));
            MainMenu.BindMenuToItem(CalloutCreator, navigateToCalloutCreatorItem);
            CalloutCreator.ParentMenu = MainMenu;
            List<dynamic> Callouts = new List<dynamic>()
            {
                "Fleeing From Crime Scene", "Crime Scene Needs Investigating", "Contaminating Evidence"
            };
            CalloutList = new UIMenuListItem("Callouts", Callouts, 0);
            MainMenu.AddItem(CalloutList);
            MainMenu.AddItem(ConfirmItem = new UIMenuItem("Confirm"));
            MainMenu.RefreshIndex();
            CalloutCreator.RefreshIndex();
            MainMenu.OnItemSelect += ItemSelected;
            MainMenu.MouseControlsEnabled = false;
            MainMenu.AllowCameraMovement = true;
            CalloutCreator.MouseControlsEnabled = false;
            CalloutCreator.AllowCameraMovement = true;
            MainLogic();
            GameFiber.Hibernate();
        }
        public static void ItemSelected(UIMenu sender, UIMenuItem selectedItem, int index)
        {
            if (sender == MainMenu)
            {
                if (selectedItem == ConfirmItem)
                {
                }
            }
        }
        public static void MainLogic()
        {
            GameFiber.StartNew(delegate
            {
                while (true)
                {
                    GameFiber.Yield();
                    if (Game.IsKeyDown(Keys.F6))
                    {
                        MainMenu.Visible = !MainMenu.Visible;
                    }
                    _menuPool.ProcessMenus();
                }
            });
        }
    }
}

 

 

Thanks In Advance

Edited by Harry Catraz
Updated EntryPoint.cs

Kind Regards,

Catraz

  • 4 weeks later...

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.