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.

diffrent ways

Featured Replies

How to make callouts with diffrent ways of ending, do you have to make for evry ways a new script?

and how to change the color of a blip (blip.color = color.Yellow) doesn't work or do i need another refrence?    blip.Color = System.Drawing.Color.Yellow;

 

Edited by epicmrjuan

Thank you

You can do it a variety of different ways. But basically:

 

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

To change the Color you do need another reference, "using System.Drawing;". To get this reference, click Project, Add Reference, click Assemblies then Framework, and look for System.Drawing or in the search box type System.Drawing and add the reference, then do using System.Drawing; and then you can do:

//Create a blip which attaches itself to myShooter.
myBlip = new Blip(myShooter);
//Color the blip in Red.
myBlip.Color = System.Drawing.Color.Red;
//Create a GPS route to myShooter in yellow.
myBlip.EnableRoute(System.Drawing.Color.Yellow);

 

If you mean to have random turnouts, it's quite complicated for beginners, it took me a while to understand it at least.

So, what I did was create different instances; such as OnScene, EnRoute, etc. This code would go right under your public Vehicle public Ped etc.

//Create an enum to assign CalloutStates as None, EnRoute, OnScene, and DecisionMade (which is when myShooter chooses an ending randomly, we will get to that //in a little bit.
enum CalloutStates { None = 0, EnRoute, OnScene, DecisionMade };
//And currently, our CalloutState is set to None, as LocalPlayer has not accepted the callout or even seen the callout displayed yet.
CalloutStates CalloutState = CalloutStates.None;

 

When the callout is accepted by LocalPlayer, we can set their status as EnRoute.

CalloutState = CalloutStates.EnRoute;

 

Now, we can set the LocalPlayer as OnScene if they are within a certain distance of the Vector3's x,y,z I have set (or you could do SpawnPoint).

This means when the player gets less than or equal to 23 meters of the coords (or SpawnPoint if you change it from coords to SpawnPoint) then it'll tell the code he's on scene, then doing StartShootingScenario(); which is at the bottom of my code as a public Void so it isn't sitting in Process() being all annoying and cluttered up, so this makes it neat and tidy and organised.

if (CalloutState == CalloutStates.EnRoute && Game.LocalPlayer.Character.Position.DistanceTo(new Vector3(-1758.445f, 125.273f, 64.774f)) <= 23f)
            {
                CalloutState = CalloutStates.OnScene;
                StartShootingScenario();
            }

 

So, after the "end" of End() we can create our new Public Void StartShootingScenario(); More information in the code after "//"

//Put this after the end of End() which starts our StartShootingScenario.
public void StartShootingScenario()
        {
            //ALWAYS START A NEW GAME FIBER IF YOU'RE GOING TO USE GameFiber.Sleep, DON'T SLEEP THE MAIN FIBER.
            GameFiber.StartNew(delegate
            {
                //Create the Pursuit
                this.Pursuit = Functions.CreatePursuit();

                //Pick a random number, to choose a random outcome
                int r = new Random().Next(1, 4);

                //Set the state to decision made, since the outcome is chosen.
                CalloutState = CalloutStates.DecisionMade;
                Game.HideHelp();

                //Execute one of the random outcomes
                if (r == 1)
                {
                    //myVictim's 1 through 6 flee the scene.
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim1, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim2, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim3, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim4, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim5, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim6, myShooter);
					
                  	//We sleep the fiber for 3 seconds.
                    GameFiber.Sleep(3000);
					
                  	//myShooter surrenders, putting his hands up for -1 (until prompted to do something else) and then facing Game.LocalPlayer.Character.
                    myShooter.Tasks.PutHandsUp(-1, Game.LocalPlayer.Character);
                  	//Then myShooter drops his current weapon.
                    NativeFunction.CallByName<uint>("SET_PED_DROPS_WEAPON", myShooter);
                  	//This is for realism, it displays a subtitle stating Officer (NAME IN INI FILE) suspect is surrendering, for 5 seconds.
                    Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: Dispatch, suspect is surrendering.", 5000);

                    //Now for another random outcome
                    if (new Random().Next(1, 3) == 2)
                    {
                        //The aggressor attacks the Victim.
                        myShooter.Tasks.FireWeaponAt(myVictim1, 30000, FiringPattern.FullAutomatic);
                      	//The cops attack the shooter.
                        myCopPed1.Tasks.FireWeaponAt(myShooter, 30000, FiringPattern.SingleShot);
                        myCopPed2.Tasks.FireWeaponAt(myShooter, 30000, FiringPattern.SingleShot);
                        Game.DisplaySubtitle("~b~Officer " + Settings.OfficerName + "~w~: SHOTS FIRED! GET SOME BACKUP HERE NOW!", 5000);
                        GameFiber.Sleep(3000);
                        Functions.PlayScannerAudio("NEED_BACKUP DISPATCH_SHOTS_FIRED REQUESTING_BACKUP");
                      	//Vitims flee in panic.
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim1, myShooter);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim2, myShooter);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim3, myShooter);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim4, myShooter);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim5, myShooter);
                        NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim6, myShooter);

                        GameFiber.Sleep(5000);
						
                      	//This initialises our pursuit, you could do "if myShooter.IsAlive { Functions.AddPed blah blah } to make sure the game doesn't crash because the shooter is dead and so it can't create a pursuit.
                        Functions.AddPedToPursuit(this.Pursuit, myShooter);
                    }
                }
                else
                {
                    //The aggressor doesn't attack the victim, instead, both peds flee. We don't need to tell the aggressor to flee, as LSPDFR's Pursuit system does that for us.
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim1, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim2, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim3, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim4, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim5, myShooter);
                    NativeFunction.CallByName<uint>("TASK_REACT_AND_FLEE_PED", myVictim6, myShooter);

                    GameFiber.Sleep(5000);

                    Functions.AddPedToPursuit(this.Pursuit, myShooter);
                }
                //Dismiss the aggressor from our plugin
                myShooter.Dismiss();

                //Dispatch a backup unit if myShooter is alive.
                if (myShooter.IsAlive)
                {
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.AirUnit);
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                    Functions.RequestBackup(Game.LocalPlayer.Character.Position, LSPD_First_Response.EBackupResponseType.Pursuit, LSPD_First_Response.EBackupUnitType.LocalUnit);
                }
            });
        }

 

If you have any questions don't be afraid to ask! My code is still a work in progress so use Game.LogTrivial("Created Ped"); and stuff like that to debug any crashes or errors this code may contain as it isn't completely done or completely tested. Good luck!

  • Author
39 minutes ago, PNWParksFan said:

You can do it a variety of different ways. But basically:

 

So if i'm right i have to do this for diffrent location in a callout?

            Random rnd = new Random();
            int month = rnd.Next(1, 5);
            int caseSwitch = 1;
            switch (caseSwitch)
            {
                case 1:
                    Console.WriteLine("loc 1");
                    {
                        SpawnPoint = new Vector3(-281, -1352, 31);
                        SpawnPoint2 = new Vector3(-281, -1341, 30);
                        coppoint = new Vector3(-279, -1342, 31);
                        suspoint = new Vector3(-280, -1343, 31);
                        ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
                        AddMinimumDistanceCheck(20f, SpawnPoint);
                        CalloutMessage = "Code 3: Broken down car on the Highway";
                        CalloutPosition = SpawnPoint;
                        Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION UNITS_RESPOND_CODE_03", SpawnPoint);
                    }

And then the other locations

Edited by epicmrjuan

Thank you

Sure but no need to repeat everything. I would do it as such, so you just switch out the part that actually changes. 

Random rnd = new Random();
int month = rnd.Next(1, 5);
int caseSwitch = 1;
Vector3 SpawnPoint;
Vector3 SpawnPoint2;
Vector3 coppoint;
Vector3 suspoint;

switch (caseSwitch)
{
  case 1:
  default:
  	Console.WriteLine("loc 1");
    SpawnPoint = new Vector3(-281, -1352, 31);
    SpawnPoint2 = new Vector3(-281, -1341, 30);
    coppoint = new Vector3(-279, -1342, 31);
    suspoint = new Vector3(-280, -1343, 31);
  	break;
  case 2:
  	// set the spawn points here for case 2
  	break;
  case 3:
  	// etc. 
  	break;
}

ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
AddMinimumDistanceCheck(20f, SpawnPoint);
CalloutMessage = "Code 3: Broken down car on the Highway";
CalloutPosition = SpawnPoint;
Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION UNITS_RESPOND_CODE_03", SpawnPoint);

You need to have a default case, and need to break after each case. 

[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
            Random rnd = new Random();
            int month = rnd.Next(1, 5);
            int caseSwitch = 1;
            switch (caseSwitch)
            {
                case 1:
                    Console.WriteLine("loc 1");
                    {
                        SpawnPoint = new Vector3(-281, -1352, 31);
                        SpawnPoint2 = new Vector3(-281, -1341, 30);
                        coppoint = new Vector3(-279, -1342, 31);
                        suspoint = new Vector3(-280, -1343, 31);
                        Suspect = new Ped("s_m_m_highsec_01", (suspoint), 176f);
                        Suspect.IsPersistent = true;
                        Suspect.BlockPermanentEvents = true;
                        Suspect.Tasks.StandStill(-1);
                        Cop = new Ped("s_m_y_hwaycop_01", (coppoint), 355f);
                        Functions.SetPedAsCop(Cop);
                        Cop.IsPersistent = true;
                        Cop.Tasks.StandStill(-1);
                        Cop.BlockPermanentEvents = true;
                        break;
                    }
                case 2:
                    Console.WriteLine("loc 2");
                    {
                        SpawnPoint = new Vector3(477, -331, 46);
                        SpawnPoint2 = new Vector3(476, -326, 46);
                        coppoint = new Vector3(473, -325, 46);
                        suspoint = new Vector3(481, -328, 45);
                        Suspect = new Ped("s_m_m_highsec_01", (suspoint), 312f);
                        Suspect.IsPersistent = true;
                        Suspect.BlockPermanentEvents = true;
                        Suspect.Tasks.StandStill(-1);
                        Cop = new Ped("s_m_y_hwaycop_01", (coppoint), 55f);
                        Functions.SetPedAsCop(Cop);
                        Cop.IsPersistent = true;
                        Cop.Tasks.StandStill(-1);
                        Cop.BlockPermanentEvents = true;
                        break;
                    }

So this works?

Do i need to create suspect and cop alreade or oncalloutaccepted()

Edited by epicmrjuan

Thank you

  • Author

@PNWParksFandidn't see your last sentence, but this don't work.

it only uses default.

Spoiler

        public override bool OnBeforeCalloutDisplayed()
        {
            // create a random number for diffrent loc.
            Random rnd = new Random();
            int month = rnd.Next(1, 3);
            int caseSwitch = 1;
            switch (caseSwitch)
            {
                default:
                    Console.WriteLine("loc 1");
                    {
                        SpawnPoint = new Vector3(-281, -1352, 31);
                        SpawnPoint2 = new Vector3(-281, -1341, 30);
                        coppoint = new Vector3(-279, -1342, 31);
                        suspoint = new Vector3(-280, -1343, 31);
                        Suspect = new Ped("s_m_m_highsec_01", (suspoint), 176f);
                        Suspect.IsPersistent = true;
                        Suspect.BlockPermanentEvents = true;
                        Suspect.Tasks.StandStill(-1);
                        Cop = new Ped("s_m_y_hwaycop_01", (coppoint), 355f);
                        Functions.SetPedAsCop(Cop);
                        Cop.IsPersistent = true;
                        Cop.Tasks.StandStill(-1);
                        Cop.BlockPermanentEvents = true;
                        car = new Vehicle("CAVALCADE", SpawnPoint, 211f);
                        Copcar = new Vehicle("POLICE4", SpawnPoint2, 132f);
                        Copcar.IsSirenOn = true;
                        Copcar.IsSirenSilent = true;
                        break;
                    }
                case 2:
                    Console.WriteLine("loc 2");
                    {
                        SpawnPoint = new Vector3(477, -331, 46);
                        SpawnPoint2 = new Vector3(476, -326, 46);
                        coppoint = new Vector3(473, -325, 46);
                        suspoint = new Vector3(481, -328, 45);
                        Suspect = new Ped("s_m_m_highsec_01", (suspoint), 312f);
                        Suspect.IsPersistent = true;
                        Suspect.BlockPermanentEvents = true;
                        Suspect.Tasks.StandStill(-1);
                        Cop = new Ped("s_m_y_hwaycop_01", (coppoint), 55f);
                        Functions.SetPedAsCop(Cop);
                        Cop.IsPersistent = true;
                        Cop.Tasks.StandStill(-1);
                        Cop.BlockPermanentEvents = true;
                        car = new Vehicle("BISON", SpawnPoint, 220f);
                        Copcar = new Vehicle("POLICE4", SpawnPoint2, 293);
                        Copcar.IsSirenOn = true;
                        Copcar.IsSirenSilent = true;
                        break;
                    }

            }
            ShowCalloutAreaBlipBeforeAccepting(SpawnPoint, 30f);
            AddMinimumDistanceCheck(20f, SpawnPoint);
            CalloutMessage = "Code 3: Broken down car on the Highway";
            CalloutPosition = SpawnPoint;
            Functions.PlayScannerAudioUsingPosition("WE_HAVE CRIME_OFFICER_IN_NEED_OF_ASSISTANCE IN_OR_ON_POSITION UNITS_RESPOND_CODE_03", SpawnPoint);

            return base.OnBeforeCalloutDisplayed();

 

 

Edited by epicmrjuan

Thank you

int caseSwitch = 1;

You do know it's always going to be case 1, right? :)

This is to make it random:

Random rnd = new Random();
int caseswitch = rnd.Next(0,3)

Remember that the integers you provide to generate a random between are exclusive, as in not inclusive

Edited by khorio

  • Author
2 minutes ago, khorio said:

int caseSwitch = 1;

You do know it's always going to be case 1, right? :)

Oops looked over it changed it to month

Thank you all guys

Edited by epicmrjuan

Thank you

Another way would be to create a struct with fields you need, eg.:

struct CalloutData
{
	Vector3 suspect1Pos;
	string suspect1Model;
	Vector3 suspect2Pos;
	string suspect2Model;
	(...)
}

and create an array of structs. Why so? You could keep adding new Callout data without modifying anything in your code (I mean you'd need to add 20. case in switch). The usage would be:

CalloutData[] calloutDataArray;
CalloutData data = calloutDataArray[randomNumber];

Ped suspect1 = new Ped(data.suspect1Position, data.suspect1Model);

 

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.