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.

Getting started!

Featured Replies

Hey there!

I am a 19 yo computer science student. I have been playing LCPDFR and LSPDFR for quite some time and I have never thought about doing something own when it comes to modding/scripting for games. But times can change I guess :wink: In february @alexguirre told me that everybody can be a dev. I will be an software developper in about 4 years (at least thats the plan) and I decided to take a look into scripting and Hopefully give this great community something more! I am learning Java at university, I hope that will make it a bit easier scince Java and C# are pretty similar.

First of all I think its the time to say thank you to all the developers who spend their time into this and make this whole thing possible. And then special thanks to @Albo1125 for taking his time to create this API-basics tutorial!

It would be great if someone could have an open eye for this thread and possibly help me when I have some questions!

For now on, I would like to know how I can spawn something on a specific location and facing a spec. direction (for example like the cars in a "Traffic Stop Backup Requiered" callout (AssortedCallouts). Tanks!

  • Replies 23
  • Views 2k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • There's an OnBeforeCalloutDisplayed function that you can override, and your distance logic would go in that function. If the player is too far, return false, and that's it. LSPDFR handles the rest.

  • ScottyTooHotty
    ScottyTooHotty

    I don't have a clue about 2 as I've never played with it at all but for 1 you need to put "GameFiber.Sleep(insert desired amount of time);". Your desired amount of time should be however long you wish

  • Put PlayScannerAudio() in a new GameFiber: GameFiber.StartNew(delegate { GameFiber.Wait(5000); PlayScannerAudio(params); }); Yes, a ped has to be within distance of x units to a vehicle to pe

Welcome! Hope you get into the swing of it soon.

For spawning stuff in specific locations/headings I recommend checking out this video:

https://youtu.be/lZUAXBYRaE4

Good luck!

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

  • Author

Quick question:

When I try to spawn a callout on a predefined postion, how do I mangage to let this callout only be displayed when the player is within a certain range?

If I would do that in my actual callout class, it would be "blocking" a callout spawn because at this point LSPDFR already wanted my callout to appear but I have to cancel it.

For the spawn point in a certain range you can try this:  spawnPoint =
                World.GetNextPositionOnStreet(Game.LocalPlayer.Character.Position.Around(300f));

  • Author

Yeah but that gives me a rendom spawnpoint right? But I have set my own coordinates. So for example i have a callout that only spawns in Sandy Shores, so I dont want the game to display it when the player is e.g. in LS

Edited by master1114

20 hours ago, master1114 said:

Yeah but that gives me a rendom spawnpoint right? But I have set my own coordinates. So for example i have a callout that only spawns in Sandy Shores, so I dont want the game to display it when the player is e.g. in LS

If the callout happens in a specific location (coordinates):
if (Game.LocalPlayer.Character.DistanceTo(callout location) > maximum distance away they can be from the callout location)

{

End();
}

Or if it's just the general area of LS and Sandy Shores:

if (NativeFunction.CallByName<uint>("GET_HASH_OF_MAP_AREA_AT_COORDS", Game.LocalPlayer.Character.Position.X, Game.LocalPlayer.Character.Position.Y, Game.LocalPlayer.Character.Position.Z) == Game.GetHashKey("city"))
{

End();

}

 

That is how I would do it. 

Edited by ScottehBoyy

ScottyTooHotty

  • Author

Yup, thats logical, but lets assume:

Player forces a callout. My callout appears, but distance check fails. Callout gets cancelled. Player does not get a callout displayed.

Or does LSPDFR has something implemented that prevents this from happening?

6 hours ago, master1114 said:

Yup, thats logical, but lets assume:

Player forces a callout. My callout appears, but distance check fails. Callout gets cancelled. Player does not get a callout displayed.

Or does LSPDFR has something implemented that prevents this from happening?

There's an OnBeforeCalloutDisplayed function that you can override, and your distance logic would go in that function. If the player is too far, return false, and that's it. LSPDFR handles the rest.

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

Thanks for the help so far!

I have two new problems so if someone wants to share some more time for me it would be great :wink:

1) The callout appears everywhere, even tho I i did what @ScottehBoyy proposed. (OnBeforeCalloutDisplayed Method)

Spoiler

if (Game.LocalPlayer.Character.DistanceTo(spawnPoint)<4000f)
            {
                return false;
            }
            

2) When I accept the callout, this appears: What did I do to cause this?

Spoiler

[15.09.2016 21:10:51.814] LSPD First Response: ==============================
[15.09.2016 21:10:51.815] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[15.09.2016 21:10:51.815] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.815] LSPD First Response: Origin: Game fiber "CalloutManager".
[15.09.2016 21:10:51.816] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.816] LSPD First Response: Exception type: System.IndexOutOfRangeException
[15.09.2016 21:10:51.817] LSPD First Response: Exception message: Der Index war außerhalb des Arraybereichs.
[15.09.2016 21:10:51.844] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.844] LSPD First Response: Inner exceptions:
[15.09.2016 21:10:51.844] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.844] LSPD First Response: Stack trace:
[15.09.2016 21:10:51.845] LSPD First Response: bei AlphaCallouts.Callouts.FreewayPet.OnCalloutAccepted()
[15.09.2016 21:10:51.845] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 338.
[15.09.2016 21:10:51.845] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 173.
[15.09.2016 21:10:51.846] bei Rage.GameFiber.Main()

 

20 hours ago, master1114 said:

Thanks for the help so far!

I have two new problems so if someone wants to share some more time for me it would be great :wink:

1) The callout appears everywhere, even tho I i did what @ScottehBoyy proposed. (OnBeforeCalloutDisplayed Method)

  Reveal hidden contents

if (Game.LocalPlayer.Character.DistanceTo(spawnPoint)<4000f)
            {
                return false;
            }
            

2) When I accept the callout, this appears: What did I do to cause this?

  Reveal hidden contents

[15.09.2016 21:10:51.814] LSPD First Response: ==============================
[15.09.2016 21:10:51.815] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[15.09.2016 21:10:51.815] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.815] LSPD First Response: Origin: Game fiber "CalloutManager".
[15.09.2016 21:10:51.816] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.816] LSPD First Response: Exception type: System.IndexOutOfRangeException
[15.09.2016 21:10:51.817] LSPD First Response: Exception message: Der Index war außerhalb des Arraybereichs.
[15.09.2016 21:10:51.844] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.844] LSPD First Response: Inner exceptions:
[15.09.2016 21:10:51.844] LSPD First Response: ------------------------------
[15.09.2016 21:10:51.844] LSPD First Response: Stack trace:
[15.09.2016 21:10:51.845] LSPD First Response: bei AlphaCallouts.Callouts.FreewayPet.OnCalloutAccepted()
[15.09.2016 21:10:51.845] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 338.
[15.09.2016 21:10:51.845] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 173.
[15.09.2016 21:10:51.846] bei Rage.GameFiber.Main()

 

Well you're telling it to return false if they're within the desired radius. Change your '<' sign to '>'.

ScottyTooHotty

  • Author

Alright, I have solved the problems above (well, they were actually pretty simple and stupid) and I am now on the point of having my callout actually going through the process routine. That brings us to 2 new questions:

1) Game.DisplaySubtitle(string) shows a subtitle text. But when you display multiple ones after each other, it only shows the last one. How to I make the game wait for the sutitle before to get removed?

2) Vehicle.Deform(Vector3 offset, float radius, float amount) should damage my vehicle. I already played around with some values. Radius dispositioned the vehicle somewhere else and the other 2 had no visible influence.

On 9/16/2016 at 8:56 PM, master1114 said:

Alright, I have solved the problems above (well, they were actually pretty simple and stupid) and I am now on the point of having my callout actually going through the process routine. That brings us to 2 new questions:

1) Game.DisplaySubtitle(string) shows a subtitle text. But when you display multiple ones after each other, it only shows the last one. How to I make the game wait for the sutitle before to get removed?

2) Vehicle.Deform(Vector3 offset, float radius, float amount) should damage my vehicle. I already played around with some values. Radius dispositioned the vehicle somewhere else and the other 2 had no visible influence.

I don't have a clue about 2 as I've never played with it at all but for 1 you need to put "GameFiber.Sleep(insert desired amount of time);". Your desired amount of time should be however long you wish the subtitle to stay on screen. It's also worth noting that the numbers you put in there are in milliseconds so if you put in "4000" then that's 4 seconds.

Edit: This is to go after your subtitle code. So it'd be:
Subtitle
Code
Subtitle
Code etc..

Edited by ScottehBoyy

ScottyTooHotty

  • Author

Thanks for the help so far :wink:

I am close to finishing my first callout. Only thing thats creating problems is the mentioned Vehicle.Deform method, wich i cant get to work. The car remains in perfect condition after using it with many different values on the parameters.

21 hours ago, master1114 said:

Thanks for the help so far :wink:

I am close to finishing my first callout. Only thing thats creating problems is the mentioned Vehicle.Deform method, wich i cant get to work. The car remains in perfect condition after using it with many different values on the parameters.

Which values are you passing to Vehicle.Deform()? This is the meaning of the paramaters:

  • Vector3 offset: is the position where to deform the vehicle at from the center of the vehicle.
  • float radius: the radius from the offset where the deformation will be applied.
  • float amount: how much deformation apply.

For example, this vehicle.Deform(new Vector3(0f, 1f, 0.225f), 50.0f, 500f); works fine to deform the front of a NINEF.

  • Author

Thanks I got it to work :)

        public override bool OnCalloutAccepted()
        {

            //SPAWN 2 CARS AND 2 PEDS

            try
            {
                KeysConverter kc = new KeysConverter();
                mainKey = (Keys)kc.ConvertFromString(AlphaCallouts.Main.getKeyBinding());
                mainKeyString = AlphaCallouts.Main.getKeyBinding();
            }
            catch
            {
                mainKey = Keys.T;
                Game.DisplayNotification("Error reading AlphaCallouts.ini. Setting default");
            }

            route = guard.AttachBlip();
            route.Color = System.Drawing.Color.DarkBlue;
            route.EnableRoute(System.Drawing.Color.DarkBlue);
            route.IsFriendly = true;

            GameFiber.Wait(5000);
            Functions.PlayScannerAudio("PLAYING_911_CALL 911_CALL_01 911_CALL_02 911_CALL_03 911_CALL_04");
            GameFiber.Wait(12000);

            return base.OnCalloutAccepted();
        }

When I accept my callout with this OnCalloutAccepted-Method, I get the following exception:

Spoiler

[22.09.2016 18:45:19.297] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[22.09.2016 18:45:19.297] LSPD First Response: ------------------------------
[22.09.2016 18:45:19.297] LSPD First Response: Origin: Game fiber "CalloutManager".
[22.09.2016 18:45:19.298] LSPD First Response: ------------------------------
[22.09.2016 18:45:19.298] LSPD First Response: Exception type: Rage.Exceptions.InvalidHandleableException
[22.09.2016 18:45:19.299] LSPD First Response: Exception message: Operation is not valid because the specified  Rage.Blip is invalid.
[22.09.2016 18:45:19.299] LSPD First Response: ------------------------------
[22.09.2016 18:45:19.299] LSPD First Response: Inner exceptions:
[22.09.2016 18:45:19.300] LSPD First Response: ------------------------------
[22.09.2016 18:45:19.300] LSPD First Response: Stack trace:
[22.09.2016 18:45:19.301] LSPD First Response: bei Rage.Blip.Delete()
[22.09.2016 18:45:19.301] bei LSPD_First_Response.Mod.Callouts.Callout.OnCalloutAccepted() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\Callout.cs:Zeile 154.
[22.09.2016 18:45:19.302] bei AlphaCallouts.Callouts.PoisonAttack.OnCalloutAccepted()
[22.09.2016 18:45:19.302] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 338.
[22.09.2016 18:45:19.302] bei ?????????????????????????????????????????.?????????????????????????????????????????() in E:\GTA V\LSPD First Response\LSPD First Response\Mod\Callouts\CalloutManager.cs:Zeile 173.
[22.09.2016 18:45:19.303] bei Rage.GameFiber.Main()

 

I set a route to a Blip attached to my ped, and thats working fine, but 3-4 seconds after accepting the callout, it crashes, while I dont even try to delete any blips in this method?

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

Similar Content

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.