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.

Blip Still Active After Arrest/Death.

Featured Replies

Once I added ABlip = new Blip(Suspect); and ABlip.Color and ABlip.EnableRoute it started to not delete the blip after arrests or death. Wicked confused because adding these lines of codes seemed to cause it.. Code below, thank you for any and all help!

 

OnCalloutAccepted():

public override bool OnCalloutAccepted()
        {
            //Set the player as en route to the scene
            state = EVehicleBlockingTrafficState.EnRoute;
            Game.DisplayNotification("~b~Officer " + Settings.OfficerName + "~w~: Dispatch, show me responding Code 2 to the Suspicious Vehicle.");
            Functions.PlayScannerAudio("10-4");

            ABlip = new Blip(Suspect);
            ABlip = Suspect.AttachBlip();
            ABlip.Color = System.Drawing.Color.Red;
            ABlip.EnableRoute(System.Drawing.Color.Yellow);

            //Block permanent events, so the victim doesn't flee if something disturbs them(A vehicle tapping them, etc..), as this would completely disrupt the callout's logic.
            Suspect.BlockPermanentEvents = true;

 

Process():

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

            //If the player is driving to the scene, and their distance to the scene is less than 15, start the callout's logic.
            if (state == EVehicleBlockingTrafficState.EnRoute && Game.LocalPlayer.Character.Position.DistanceTo(spawnPoint) <= 10)
            {
                //Set the player as on scene
                state = EVehicleBlockingTrafficState.OnScene;

                //Start the callout's logic.
                StartVehicleBlockingTrafficScenario();
            }

            if (Suspect.IsDead)
            {
                Game.DisplayNotification("~b~Officer " + Settings.OfficerName + "~w~: Suspect is down, Code 4.");
                Game.DisplaySubtitle("Call for Coroner to clean up the dead body.", 10000);
                Functions.PlayScannerAudio("CODE4 SUSP_DOWN");
                ABlip.Delete();
                End();
            }
            if (Suspect.IsCuffed)
            {
                Game.DisplayNotification("~b~Officer~w~: Suspect in custody, Code 4.");
                Functions.PlayScannerAudio("CODE4 SUSP_ARRESTED");
                ABlip.Delete();
                End();
            }

 

End():

public override void End()
        {
            if (Suspect.Exists()) Suspect.Dismiss();

            if (ABlip.Exists()) ABlip.Delete();

            base.End();
        }

 

  • Replies 25
  • Views 1.9k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • ainesophaur
    ainesophaur

    It'd be better to keep the entire conversation in a list. Then you can sequentially show the text and remove it from the list. Once all the items are removed from the list, the conversation is over. T

  • ainesophaur
    ainesophaur

    Finally around to the computer and snagged a few mins to give an example of what I was talking about with dictionaries EDIT: Dont remove the items from the list :) there are smarter ways lik

  • alexguirre
    alexguirre

    You're creating two blips: ABlip = new Blip(Suspect); ABlip = Suspect.AttachBlip(); Both methods do the same, create a blip and attach it to the Suspect Ped, but ABlip o

  • Author
Just now, alexguirre said:

You're creating two blips:


            ABlip = new Blip(Suspect);
            ABlip = Suspect.AttachBlip();

Both methods do the same, create a blip and attach it to the Suspect Ped, but ABlip only references the last one so the first one never gets deleted.
Choose one and delete the other.

Ahh, I didn't know that new Blip(Suspect) also attach's the blip. Thanks Alex, much appreciated!

39 minutes ago, ToastinYou said:

Ahh, I didn't know that new Blip(Suspect) also attach's the blip. Thanks Alex, much appreciated!

Yes, and Entity.AttachBlip() will give problems when you try to delete it, use the other method.

21 minutes ago, khorio said:

Yes, and Entity.AttachBlip() will give problems when you try to delete it, use the other method.

I've experienced this too. I prefer initializing the blip myself and keeping a reference to it.

  • Author

Off topic but don't want to start a new topic.. anyone here know how to make it so with the code below to make it so if you hit the key specified, it will read off subtitle one, then the next if you press the specified key after, then the next if you press the specified key again, and so on.. Where it stands when you press the specified key it skips all the way to the bottom. I can see how, but is there something other than IsKeyDown to fix this from skipping to the bottom? Or do I have something setup wrong? Thanks for the help.

            if (Game.LocalPlayer.Character.Position.DistanceTo(SpawnPoint) <= 35)
            {
                Game.DisplayHelp("Stand back and talk with the suspect.");
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: Let it end peacefully by putting the gun down!", 7500);
                }
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: Why would I? Life isn't worth living for..", 5000);
                }
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: THEY'RE ALL SLAVES TO THIS SCHOOL, I SHALL LET THEM BE FREE!", 5000);
                }
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: They are scared, can't you see? In their faces.. put it down and we can help you!", 7500);
                }

 

  • Author
2 minutes ago, khorio said:

use different states; conv1, conv2, etc..

You talking about instead of TalkKey? I have the key specified in the INI file, I wouldn't want ten different conversation keys if that's what you're saying. @khorio

switch (state)

{

case estate.state1:

if(Key.isdown(keys.y)

{ blablabla;
 state = estate.state2;
break;

case estate.state2:

if(Key.isdown(keys.y)

{ blabla2;
state = estate.state2;
break

etc

eating chicken nuggets right now so dont mind the syntax

Edited by khorio

  • Author
10 minutes ago, khorio said:

switch (state)

{

case estate.state1:

if(Key.isdown(keys.y)

{ blablabla;
 state = estate.state2;
break;

case estate.state2:

if(Key.isdown(keys.y)

{ blabla2;
state = estate.state2;
break

etc

eating chicken nuggets right now so dont mind the syntax

Where does estate come from? Am I suppose to create it somewhere or is it from some reference? If it comes from a reference I don't have it as it's showing it doesn't exist. Nice edit btw, lovin' them nuggets? lol

private enum Estate
{
	conv1,
	conv2,
	conv3,
}

private Estate state = Estate.conv1;

then in your main process

switch (state)

case Estate.conv1:
		if(Game.IsKeyDown(Keys.Whatever)
		{
			whatevercalls you make here;
			state = Estate.conv2;
		}
		break;
case Estate.conv2:
		if(Game.IsKeyDown(Keys.Whatever)
		{
			blahblah

like this

It'd be better to keep the entire conversation in a list. Then you can sequentially show the text and remove it from the list. Once all the items are removed from the list, the conversation is over. The only reason I would use an enum to track state is if you had multiple conversations.. Which I would then store them in a dictionary with the enum of conversation types as the key and the list of strings for the conversation as the value.

I'm on my phone ATM so if it all doesn't make sense I can post an example later

  • Author
6 minutes ago, ainesophaur said:

It'd be better to keep the entire conversation in a list. Then you can sequentially show the text and remove it from the list. Once all the items are removed from the list, the conversation is over. The only reason I would use an enum to track state is if you had multiple conversations.. Which I would then store them in a dictionary with the enum of conversation types as the key and the list of strings for the conversation as the value.

I'm on my phone ATM so if it all doesn't make sense I can post an example later

Yeah that doesn't make any sense to me. I have it as what he told me right now, but what you have stated seems to be the more ideal way to go, if I knew how to do it. If you could post an example later that'd be great, if not I understand - what I have currently will have to work for the time being haha. Thank you everyone for the help!

10 minutes ago, ToastinYou said:

Yeah that doesn't make any sense to me. I have it as what he told me right now, but what you have stated seems to be the more ideal way to go, if I knew how to do it. If you could post an example later that'd be great, if not I understand - what I have currently will have to work for the time being haha. Thank you everyone for the help!

List<String> mySpeechLines = new List<String>();

int speechIndex = 0;

//Add lines to list with mySpeechLines.Add

//Increment speechindex with each button press and display mySpeechLines[speechIndex] whenever the key is pressed. When you get to the last item, set speechindex back to 0. You can remove the items if you want and just use index 0, but maintaining it let's the user go through the sequence multiple times. 

I'm on my phone, but that's the gist of it. 

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

  • Author
15 minutes ago, Stealth22 said:

List<String> mySpeechLines = new List<String>();

int speechIndex = 0;

//Add lines to list with mySpeechLines.Add

//Increment speechindex with each button press and display mySpeechLines[speechIndex] whenever the key is pressed. When you get to the last item, set speechindex back to 0.

I'm on my phone, but that's the gist of it. 

 

Okay.. so I got the List and the Adding lines etc, but the SpeechIndex has stumbled me because it's saying that it has already been defined and I don't know how to setup the IsKeyDown part as mySpeechLines[SpeechIndex] is saying something about it can't be used as a statement. I'm sure I'm doing a lot wrong and you're probably facepalming right now lol.. Sorry for the troubles Stealth. (I'm trying to crank this update out so I can get it to my BETA testers so I'm really tired as it's getting late haha)

            if (Game.LocalPlayer.Character.Position.DistanceTo(SpawnPoint) <= 35)
            {
                Game.DisplayHelp("Stand back and talk with the suspect.");
                List<String> mySpeechLines = new List<String>();

                int SpeechIndex = 0;

                mySpeechLines.Add("~b~Officer " + Settings.OfficerName + "~w~: Let it end peacefully by putting the gun down! (1/1)");
                int SpeechIndex = 1;
                if (Game.IsKeyDown(Settings.TalkKey))
                {
                    mySpeechLines[SpeechIndex];
                }
                mySpeechLines.Add("~r~Suspect~w~: Why would I? Life isn't worth living for.. (1/2)");
                mySpeechLines.Add("~r~Suspect~w~: THEY'RE ALL SLAVES TO THIS SCHOOL, I SHALL LET THEM BE FREE! (2/2)");
                mySpeechLines.Add("~b~Officer " + Settings.OfficerName + "~w~: They are scared, can't you see? In their faces.. (1/2)");
                mySpeechLines.Add("~b~Officer " + Settings.OfficerName + "~w~: Put it down and we can help you! (2/2)");
                int SpeechIndex = 0;

 

Both the list and int should be global variables in your callout class. 

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

  • Author
1 minute ago, Stealth22 said:

Both the list and int are global variables in your callout class. 

Woops haha, like I said a bit tired at the moment.

I'm still getting an error for mySpeechLines[SpeechIndex]; though.. "Only assignment, call, increment, decrement, and new object expressions can be used as a statement." Any idea on how to fix this?

if (Game.IsKeyDown(Settings.TalkKey))
                {
                    mySpeechLines[SpeechIndex];
                }

 

Finally around to the computer and snagged a few mins to give an example of what I was talking about with dictionaries

EDIT:

Dont remove the items from the list :) there are smarter ways like using enumerators.. I just wrote this as quickly as possible and then realized what I had done

 enum ConversationTypes { Impatient, Regular, Danger, None = 0 }
        /**
        * Imagine you had three different types of dialogs a suspect could use.
        * I used the enum above to track them and the variable below to track which one is picked
        */
        ConversationTypes Current = ConversationTypes.None;

        /**
        * The below variable is a dictionary which means it stores items as a Key, Value pair rather
        * than a flat list.
        */

        Dictionary<ConversationTypes, List<String>> DialogMessages = new Dictionary<ConversationTypes, List<string>>()
        {
            /** 
            * We are creating the list of dictionary entries during the construction of the dictionary.
            * Alternatively we could have DialogMessages = new Dictionary() and then done the following..
            *  List<String> regular = new List<string>();
            *  regular.Add("Hello Officer");
            *  regular.Add("I'm sorry");
            *  ...
            *  DialogMessages.Add(ConversationTypes.Regular, regular);
            *
            *  But why have all that extra code :)
            *  http://stackoverflow.com/questions/17047602/proper-way-to-initialize-a-c-sharp-dictionary-with-values-already-in-it
            */
            { ConversationTypes.Regular, new List<string>()
                {
                    "Hello Officer",
                    "I'm sorry for not paying attention",
                    "Have a nice day"
                }
            },
            { ConversationTypes.Danger, new List<string>()
                {
                    "You better get away from me",
                    "I'm having a bad day",
                    "Ok time to die"
                }
            },
            { ConversationTypes.Impatient, new List<string>()
                {
                    "I dont have time for this",
                    "Can we hurry this up",
                    "Can you do anything right"
                }
            }
        };
        void Process()
        {
            /**
             * Imagine you've triggered some process to show the messages.
             * and you determined the conversation should be Impatient
             */
            List<String> messages = DialogMessages[ConversationTypes.Impatient];
            
            //Now you're showing the messge.. normally you'd check to see if there are any items left
            // For bravarity sake we'll just do some basic things
            // while(messages.Count > 0)
            String messageToShow = messages[0];
            // Show the message
            messages.RemoveAt(0);

            //If there are no more items left, we are done.

        }

 

Edited by ainesophaur

22 minutes ago, ainesophaur said:

Finally around to the computer and snagged a few mins to give an example of what I was talking about with dictionaries

EDIT:

Dont remove the items from the list :) there are smarter ways like using enumerators.. I just wrote this as quickly as possible and then realized what I had done

<snip>

That's one hell of a nice explanation :)

  • Author
11 hours ago, ainesophaur said:

Finally around to the computer and snagged a few mins to give an example of what I was talking about with dictionaries

EDIT:

Dont remove the items from the list :) there are smarter ways like using enumerators.. I just wrote this as quickly as possible and then realized what I had done


 enum ConversationTypes { Impatient, Regular, Danger, None = 0 }
        /**
        * Imagine you had three different types of dialogs a suspect could use.
        * I used the enum above to track them and the variable below to track which one is picked
        */
        ConversationTypes Current = ConversationTypes.None;

        /**
        * The below variable is a dictionary which means it stores items as a Key, Value pair rather
        * than a flat list.
        */

        Dictionary<ConversationTypes, List<String>> DialogMessages = new Dictionary<ConversationTypes, List<string>>()
        {
            /** 
            * We are creating the list of dictionary entries during the construction of the dictionary.
            * Alternatively we could have DialogMessages = new Dictionary() and then done the following..
            *  List<String> regular = new List<string>();
            *  regular.Add("Hello Officer");
            *  regular.Add("I'm sorry");
            *  ...
            *  DialogMessages.Add(ConversationTypes.Regular, regular);
            *
            *  But why have all that extra code :)
            *  http://stackoverflow.com/questions/17047602/proper-way-to-initialize-a-c-sharp-dictionary-with-values-already-in-it
            */
            { ConversationTypes.Regular, new List<string>()
                {
                    "Hello Officer",
                    "I'm sorry for not paying attention",
                    "Have a nice day"
                }
            },
            { ConversationTypes.Danger, new List<string>()
                {
                    "You better get away from me",
                    "I'm having a bad day",
                    "Ok time to die"
                }
            },
            { ConversationTypes.Impatient, new List<string>()
                {
                    "I dont have time for this",
                    "Can we hurry this up",
                    "Can you do anything right"
                }
            }
        };
        void Process()
        {
            /**
             * Imagine you've triggered some process to show the messages.
             * and you determined the conversation should be Impatient
             */
            List<String> messages = DialogMessages[ConversationTypes.Impatient];
            
            //Now you're showing the messge.. normally you'd check to see if there are any items left
            // For bravarity sake we'll just do some basic things
            // while(messages.Count > 0)
            String messageToShow = messages[0];
            // Show the message
            messages.RemoveAt(0);

            //If there are no more items left, we are done.

        }

 

Where the hell do I put this? If I put it in process I can't get Process()'s end "}" to register so it messes up everything.

Says void cannot be used in current context and Process() is called but never used. 

Process:

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

            //If the player is driving to the scene, and their distance to the scene is less than 15, start the callout's logic.
            if (state == EMuggingState.EnRoute && Game.LocalPlayer.Character.Position.DistanceTo(new Vector3(-1758.445f, 125.273f, 64.774f)) <= 20)
            {
                //Set the player as on scene
                state = EMuggingState.OnScene;

                //Start the callout's logic.
                StartMuggingScenario();
            }
            {
                { ConversationTypes.Regular, new List<string>()
            {
                "Hi Officer!",
                "Hey suspect, just testing!",
                "Okay bye now."
            };
                }
            };
            void Process()
                {
                List<String> messages = DialogMessages[ConversationTypes.Regular];
                String messageToShow = messages[0];
                messages.RemoveAt(0);
            }

 

First part of my code (after public assignments of Ped etc)

enum ConversationTypes { Regular, None = 0 }

        ConversationTypes Current = ConversationTypes.None;

        Dictionary<ConversationTypes, List<String>> DialogMessages = new Dictionary<ConversationTypes, List<string>>()
        {
            { ConversationTypes.Regular, new List<string>()
            {
                "Testing Officer",
                "Okay, sounds good!"
            }
        }
        };

 

Edited by ToastinYou

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.