Jump to content

How can I set route to specific location?


GodlyDev

Recommended Posts

Here is an example:

 

namespace YourCalloutsName.Callouts {


    [CalloutInfo("CalloutName", CalloutProbability.VeryHigh)]

    class YourCalloutName : Callout {

        private Vector3 YourDestination;
        private Blip PedsBlip;

        ...
        ...


        public override bool OnBeforeCalloutDisplayed() {

            YourDestination = World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(550f));            ------  Change Vector3 to an X,Y,Z Location
            ShowCalloutAreaBlipBeforeAccepting(PedsBlip, 30f);
            AddMinimumDistanceCheck(20f, YourDestination);

            CalloutMessage = "YourCalloutName";
            CalloutPosition = YourDestination;

            return base.OnBeforeCalloutDisplayed();
        }

        public override bool OnCalloutAccepted() {

            ...

            // Making new Ped and it's Blip.
            Ped = new Ped(YourDestination);
            Ped.BlockPermanentEvents = true;
            PedsBlip = Owner.AttachBlip();
            PedsBlip.Color = (System.Drawing.Color.Yellow);   // Ypu can change the color. 
            PedsBlip.EnableRoute(System.Drawing.Color.Yellow);  // You can change the color. 

            PedsBlip.IsFriendly = true;   // Depending your callout. 


            return base.OnCalloutAccepted();
        }


        public override void Process() {    // Your Callouts Process. (Scene)
            base.Process();

            if (Game.IsKeyDown(System.Windows.Forms.Keys.End)) {     // When User presses "END" key, the callout will forcefully end. Remember to delete your Blips! 

                Game.DisplayNotification("~g~Code 4~w~, return to patrol.");
                Functions.PlayScannerAudio("ATTENTION_ALL_UNITS WE_ARE_CODE_4");
                End();
            }


        }

    

        public override void End() {

            if (Ped.Exists()) {
                Ped.Dismiss();
            }
            if (PedsBlip.Exists()) {
                PedsBlip.Delete();
            }

            PedsBlip.DisableRoute();  // Disable.Route disables the GPS route. 

            base.End();
        } 
    }

}


 

 

Remember to always delete the In-Game Blips and GPS Routes when your Callout ends. They will not be deleted automatically. :

 

 

Hope this helps!

 

 

HELLO!!     I'm a Greek guy and YouTuber.   I really like Modding and playing LSPDFR!  I'm  very familiar with Programming (Coding) and PC Hardware / Software. I'm also a Cuber ( I Solve Rubicks Cubes and other kinds).   

My YouTube Channel:  https://www.youtube.com/c/ATGGGR/

 

 

 

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