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.

Debugging and Other Questions

Featured Replies

Hi,

 

I wanted to play around with LSPDFR and se if I can crate a very basic callout or event. I am programming for iOS in Swift for my small LLC (though not my main profession). C# is new to me but it seams pretty easy.

 

I have some API Debugging questions:

 

1. Can you force a callout for debugging in code? I know there is this callout manager add on, but I was wondering if there was a way to do this programmatically.

2. Other than logging into a file, and displaying messages in game, is there any other way to debug? Any real time debugging (I guess not but I might as well ask right?).

3. Any tutorials youtube or github or whatever, for creating world events would be appreciated.

4. When I start the game with my callout.dll in place, I do not see the dll listed in RageHook's plugin list. Any example on how to do that?

 

Thanks a lot!

4 hours ago, Normann said:

1. Can you force a callout for debugging in code? I know there is this callout manager add on, but I was wondering if there was a way to do this programmatically.

2. Other than logging into a file, and displaying messages in game, is there any other way to debug? Any real time debugging (I guess not but I might as well ask right?).

3. Any tutorials youtube or github or whatever, for creating world events would be appreciated.

4. When I start the game with my callout.dll in place, I do not see the dll listed in RageHook's plugin list. Any example on how to do that?

 

1.  If you're asking how to programmatically start your callout in-game, LSPDFR has a StartCallout function you may find useful.

2.  If you're asking if you can run your .dll through a debugger, then no, not that I'm aware of.

3.  What do you mean by creating world events?  Like ambient events?  The Initialize function from your EntryPoint class is where you want to start doing stuff.

4.  If it's an LSPDFR plugin, it goes in the "plugins/LSPDFR" folder and will be loaded by LSPDFR.  If it's a standalone plugin, it goes in the "plugins" folder and will show up in the list of Rage plugins you can load on startup.

Released plugins

Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired?

  • Management Team

You can attach Visual Studio to debug your callouts. It might make the game crash after a while since the anti-debugging is not removed entirely by us, but it should help for most situations. If you use Debugger.Launch in your code it will pause the game once the line is hit if no debugger is attached and present you with a window to select a debugger you want to attach. This works best in windowed/borderless for obvious reasons.

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

40 minutes ago, LMS said:

You can attach Visual Studio to debug your callouts. It might make the game crash after a while since the anti-debugging is not removed entirely by us, but it should help for most situations. If you use Debugger.Launch in your code it will pause the game once the line is hit if no debugger is attached and present you with a window to select a debugger you want to attach. This works best in windowed/borderless for obvious reasons.

Neat, didn't know this.  Thanks!

Released plugins

Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired?

  • Author

Thanks for the replies. Spent a few hours mimicking code from the git repo Albo1125 has. I guess the hardest part for me is the Rage docs. They are sparse.

 

Rich,

 

1. I did find the StartCallout method and I could fire it inside a Plugin class but I did not yet find the right place inside a Callout class yet. I have looked at the threading functions in Albo's code.  I did crate a thread to listen for keyboard input but putting that into the Process method in a Callout class crashed the game. I am sure I did it wrong. I ended up just using CalloutsManager, and it does the job. I can fire my dll whenever. Good for the moment.

2. I will look into how to attach VS as LMS suggested.

3. By world event I mean background events. I.e. you drive by a certain location and assign a chance to an event to fire. I.e. someone is smashing a window of a car and you are within X feet and it is night. So not like a callout but something that a player can observe (or might miss), and act upon. I guess this would be a plugin vs callout?

4. Thanks! I did figure where what dll goes eventually.... like, after a few hours I did.

 

So far I was able to create a callout, play some audio, get directions to the call when accepted, upon closing add a random vehicle spawning along the road with some damage, and a driver that might be drunk. and have him play a drunk animation upon the officer's arrival. Plus some messages. I was happy with my progress for a Sunday afternoon learn something new coding session. I am not sure I will have the time and the drive to actually make something useful for others but it is fun to do something new.

 

Another Q:

Any code example, or suggestions for moving a vehicle to the shoulder of the road? I could figure out how to spawn a vehicle along a random road (again, by following Albo's code), and make the driver drive to a point. But not sure how to grab the coordinate of the side of the road close to the car as a Vector3. Unless, of course, if I don't make the location random and I just take the values from the map.

 

I am trying to get a disabled vehicle scenario for a starter. But at the moment it spawn usually in the middle of the road. I do have some VERY bad ideas, like getting a random point along the road very near the starter position, then increase the radius and get another point, then again and again at a larger radius, repeat this a few times until I have a few hundred points along the road. After some math that should give me an approximate direction the road goes, and then figure a vector to drive to. But there has got to be some trick or a method perhaps. I was trying to search but came up empty.

 

Thanks!

 

7 hours ago, Normann said:

Another Q:

Any code example, or suggestions for moving a vehicle to the shoulder of the road? I could figure out how to spawn a vehicle along a random road (again, by following Albo's code), and make the driver drive to a point. But not sure how to grab the coordinate of the side of the road close to the car as a Vector3. Unless, of course, if I don't make the location random and I just take the values from the map.

 

For this you'll probably have to use natives.  https://nativedb.dotindustries.dev/natives  Natives are called using "Rage.NativeFunction.Natives"  For example, "Rage.NativeFunction.Natives.IS_PED_IN_VEHICLE(myPed, someVehicle, false)" or "Rage.NativeFunction.Natives.xA3EE4A07279BB9DB(myPed, someVehicle, false)"

 

Some natives only work using their hash (starting at x followed by the random string of letters and numbers.  For getting the shoulder of a road, you might check the "_GET_ROAD_SIDE_POINT_WITH_HEADING" native.  Since it begins with an underscore, you should call it with its hash.

Released plugins

Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired?

  • Author

Well. I am trying to experiment with the function you have mentioned but I am doing something wrong as it is crashing. Probably because I have very little experience with pointers and out parameters. The signature of the function is this.

 

BOOL _GET_ROAD_SIDE_POINT_WITH_HEADING(float x, float y, float z, float heading, Vector3* outPosition);

 

790968808_Screenshot2020-11-09143526.thumb.png.3a9f4a4cbe0ccaf83f8d185873b7add4.png

 

Any idea why the crash?

 

I don't think all the unsafe and explicit pointer stuff is necessary.  Could try just the following (Natives screw me up too):

 

NativeFunction.Natives.xA0F8A7517A273C05<bool>(spawnPoint.X, spawnPoint.Y, spawnPoint.Z, brokenVehicle.Heading, out Vector3 outPosition);
brokenVehicle.Position = outPosition;

 

Released plugins

Rich's Police EnhancementsScene Manager | Rich Ambiance

Retired?

  • Author

Your code works. Thank you!

 

I see what I did different. I've declarer an outPosition Vector3 variable before calling that function. But that is not even needed. Yeah this is me not knowing C# or any other more basic languages. Swift is a a walk in the park compared to this.

 

So it works now. The car is on the side of the road. Now I just need to figure out the heading of the road. Sweet!

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.