Jump to content

Problem with Callout making


JordanIT21

Recommended Posts

Hello as stated in the title i got a problem with my callout.

 

The callout is recognized and all that it pops up in lspdfr but when pressing *Y* to accept it just does a code 4 - Diregared and I just can't wrap my mind around it?
what did I do wrong?

 

Soure code:

Spoiler

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 System.Drawing;

namespace GileransUCallout.Callouts
{

    [CalloutInfo("IntoxicatedIndividual", CalloutProbability.Medium)]
    class IntoxicatedIndividual: Callout
    {
        private Ped Suspect;
        private Blip SuspectBlip;
        private Vector3 Spawnpoint;
        private float heading;
        private int counter;
        private string maleFemale;

        public override bool OnBeforeCalloutDisplayed()
        {
            Spawnpoint = new Vector3(2760.251f, 3472.108f, 55.26629f);
            heading = 66.64632f;
            ShowCalloutAreaBlipBeforeAccepting(Spawnpoint, 30f);
            AddMaximumDistanceCheck(30F, Spawnpoint);
            CalloutMessage = "Intoxicated Person disturbing the peace";
            CalloutPosition = Spawnpoint;

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted()
        {
            Suspect = new Ped("A_M_M_HILLBILLY_02", Spawnpoint, heading);
            Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;

            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.Color = System.Drawing.Color.DarkGreen;
            SuspectBlip.IsRouteEnabled = true;

            if (Suspect.IsMale)
                maleFemale = "sir";
            else
                maleFemale = "maam";

            counter = 0;

            return base.OnCalloutAccepted();
        }

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

            if (Game.LocalPlayer.Character.DistanceTo(Suspect) <= 10f)
            {
                Game.DisplayHelp("Press 'Y' to talk to the suspect", false);

                if (Game.IsKeyDown(System.Windows.Forms.Keys.Y))
                {
                    counter++;

                    if (counter == 1)
                    {
                        Game.DisplaySubtitle("Player: Excuse me " + maleFemale + ", we have gotten a lot of calls stating that you publicly drunk and won't leave the property");
                    }
                    if (counter == 2)
                    {
                        Game.DisplaySubtitle("Suspect: Nahh *hic* I'm not d-d-drunk");
                    }
                    if (counter == 3)
                    {
                        Game.DisplaySubtitle("Playey: You are clearly drunk, either you leave the property now or i arrest you for Public intoxication");
                    }
                    if (counter == 4)
                    {
                        Game.DisplaySubtitle("Suspect: Aaalright *hic* I'm leaving now!");
                    }
                    if (counter >= 5)
                    {
                        Game.DisplayHelp("No further speech.");
                    }

                }
            }

            if (Suspect.IsCuffed || Suspect.IsDead || Game.LocalPlayer.Character.IsDead || !Suspect.Exists())
            {
                End();
            }

        }

        public override void End()
        {

            if (Suspect.Exists())
            {
                Suspect.Dismiss();
            }
            if (SuspectBlip.Exists())
            {
                SuspectBlip.Delete();
            }

            base.End();

           
            Game.LogTrivial("GileransUCallout - Intoxicated Individual cleaned up.");
        }
    }
}
 

 

Link to comment
Share on other sites

  • Management Team

That usually happens when one of the callout's prerequisites are not met, for instance the minimum or maximum distance. In your case, are you close enough to the position when the callout is dispatched (you set it to 30 meters)?

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Link to comment
Share on other sites

1 hour ago, LMS said:

That usually happens when one of the callout's prerequisites are not met, for instance the minimum or maximum distance. In your case, are you close enough to the position when the callout is dispatched (you set it to 30 meters)?

 

Yes, I am within the 30-meter limit but I also tried outside the limit and the plugin will spawn the ped exactly where I told it to but it doesn't matter where I am located 30+ or 30- it will still disregard the callout.

Link to comment
Share on other sites

Is this happening every time?
I believe it gets also disregard when like the OnCalloutAccept() fails afaik. Try spawning the suspect in the OnBeforeCalloutDisplayed().

In the end you could check your distance to that specific Vector3 Position via console before triggering the Callout. Just to be sure its not that.
Or you start debugging.

Edited by ziipzaaapM16A4

Take a look at my Plugins:

AmbientAICallouts: Ai get calls too. Callouts can turn into a backup request for the player [YouTube Link]

Search Vehicle Plugin: Simple and more Immersive Vehicle Search Plugin [YouTube Link]

What Was You Name Again?: Get the name of a Suspect even when arrested and placed in your Vehicle [YouTube Link]
Corpse Inspection:  Investigate the corpse. Interact and search for details in a more Cinematic way  [YouTube Link]
[WIP] EnvoirementalCallouts: A couple of Callouts and WorldEvents that are likely to happen to you while you're on duty [Youtube Link]

[OnHold] EMS Support: Be the First Responder of Medical Emergency's and do CPR on Patients [YouTube Link]

 

spacer.png

Checkout my Patreon for Early Access to my mods                                       checkout my Discord Server

Link to comment
Share on other sites

On 12/29/2021 at 12:21 PM, ziipzaaapM16A4 said:

Is this happening every time?
I believe it gets also disregard when like the OnCalloutAccept() fails afaik. Try spawning the suspect in the OnBeforeCalloutDisplayed().

In the end you could check your distance to that specific Vector3 Position via console before triggering the Callout. Just to be sure its not that.
Or you start debugging.

 

I fixed this issue a long time ago, forgot to change it to solved but before i do so i have 1 more problem I can't seem to fix on my own 

 

Im making a code99 call currently but i won't spawn in the police car. 

 

Source code:

Spoiler

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 System.Drawing;
using Rage.Native;

namespace SpeedyPursuit.Callouts
{
    [CalloutInfo("Code99", CalloutProbability.Low)]
    public class Code99 : Callout
    {
        private Ped Suspect;
        private Ped Officer;
        private Blip OfficerBlip;
        private Blip SuspectBlip;
        private Vector3 Officerspawn;

        private Vector3 Officervehiclespawn;
        private float Officervehicleheading;

        private Vehicle Officervehicle;

        private Vector3 Spawnpoint;

        private int counter;

 

        public override bool OnBeforeCalloutDisplayed()
        {
            Officervehicleheading = 68.792f;

            Officerspawn = new Vector3(-58f, -218f, 45f);
            Officervehiclespawn = new Vector3(-365f, -126, 252f);
           

            Spawnpoint = new Vector3(-61f, -219f, 45f);

            ShowCalloutAreaBlipBeforeAccepting(Spawnpoint, 30f);
            AddMinimumDistanceCheck(240f, Spawnpoint);
            CalloutMessage = "~r~Code 99 All Units responde~w~";
            CalloutPosition = Spawnpoint;
            Functions.PlayScannerAudioUsingPosition("UNITS_RESPOND_CODE_99_01", Spawnpoint);

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted()
        {

            Game.DisplayNotification("web_lossantospolicedept", "web_lossantospolicedept", "~b~SpeedyPursuit~b~", "~r~PANIC ALARM TRIGGERD~w~", "~r~Dispacth:~w~ All Units responde immediately, Officer triggerd Panic Alarm");
            Game.DisplaySubtitle("~b~ *Thinking*~w~ ~r~Code 99~w~ ~b~I better be ready for anything~w~");
            Game.DisplayNotification("~r~CODE:~w~ ~Y~3 Response~w~");
            Functions.PlayScannerAudio("UNITS_RESPOND_CODE_99_02");

            Officervehicle = new Vehicle("POLICE1", Officervehiclespawn);
            Officervehicle.IsPersistent = true;
            Officervehicle.IsSirenSilent = true;

            Officer = new Ped("S_F_Y_COP_01", Officerspawn, Officervehicleheading);
            Officer.IsPersistent = true;
            Officer.BlockPermanentEvents = true;

            OfficerBlip = Officer.AttachBlip();
            OfficerBlip.Color = System.Drawing.Color.LightBlue;
            OfficerBlip.IsRouteEnabled = true;

            Suspect = new Ped("A_M_Y_BEACHVESP_01", Spawnpoint, Officervehicleheading);
            Suspect.IsPersistent = true;
            Suspect.BlockPermanentEvents = true;

            SuspectBlip = Suspect.AttachBlip();
            SuspectBlip.Color = System.Drawing.Color.Red;
            SuspectBlip.IsRouteEnabled = false;

            Suspect.Inventory.GiveNewWeapon("WEAPON_PISTOL", 100, true);
            NativeFunction.Natives.SetPedCombatAttributes(Suspect, 1, true);
            Suspect.Tasks.FightAgainst(Game.LocalPlayer.Character);
            
            Officer.Health = 0;

            counter = 0;

            return base.OnCalloutAccepted();
        }

        public override void Process()
        {

            base.Process();

            if (Game.LocalPlayer.Character.DistanceTo(Officer) <= 4f)
            {
                Game.DisplayHelp("Check the status of the officer, To do so press 'Y' | Press U to end the callout");
                if (Game.IsKeyDown(System.Windows.Forms.Keys.Y))
                {
                    counter++;

                    if (counter == 1)
                    {
                        Game.DisplaySubtitle("~b~I need to call for EMS!~w~");
                    }
                }

            }
            if (Rage.Game.IsKeyDown(System.Windows.Forms.Keys.U))
            {
                End();
            }

            if (Suspect.IsCuffed || Suspect.IsCuffed || Suspect.IsDead || !Suspect.Exists() || Suspect.IsDead || Game.LocalPlayer.Character.IsDead || !Suspect.Exists())
            {
                End();
            }
        }

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

            if (Officer.Exists())
            {
                Officer.Dismiss();
            }
            if (OfficerBlip.Exists())
            {
                OfficerBlip.Delete();
            }
            if (SuspectBlip.Exists())
            {
                SuspectBlip.Delete();
            }


            Game.LogTrivial("SpeedyPursuit - Code99 cleaned up!");
            Game.DisplayNotification("~b~SpeedyPursuit~w~ - ~g~Code 4~w~");
            Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE 4");
        }
    }
}

 

Link to comment
Share on other sites

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...