Jump to content
View in the app

A better way to browse. Learn more.

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

Featured Replies

Posted

Hello everyone, I've successfuly managed to spawn object in the game, although I would need to store it in C# to be able to handle them, rotate them and such. But the thing is that Rage Plugin Hook for RDR2 has no such variables that I could use to store them, and whenever I try to store them to a normal c# object, it throws an error.

 

I call this native "CREATE_OBJECT" (0x509D5878EB39E842), like this:

Game.CallNative(0x509D5878EB39E842, "P_GEN_POSTERWANTED05X".HashCode(), PlayerPed.Position.X, PlayerPed.Position.Y, PlayerPed.Position.Z, false, false, true, false, false);

 

But just as the NativeDB states, this native returns a Type "Object". So I would have to use:

Some_var_Type _object = Game.CallNative<Some_var_Type>(0x509D5878EB39E842, "P_GEN_POSTERWANTED05X".HashCode(), PlayerPed.Position.X, PlayerPed.Position.Y, PlayerPed.Position.Z, false, false, true, false, false);

to store it.

 

Everytime I try to create it like this:

 

object _object = Game.CallNative<object>(0x509D5878EB39E842, "P_GEN_POSTERWANTED05X".HashCode(), TfaRageUtils.PlayerPed.Position.X, TfaRageUtils.PlayerPed.Position.Y, TfaRageUtils.PlayerPed.Position.Z, false, false, true, false, false);

it throws the following error:

System.ArgumentException: The specified structure must allow representation by bits / bytes or have schema information.

With code: -2147024809

 

 

How can I manage this? Or is it currently impossible?

 

Thank you in advance!

Game entities are of a handle type which is a 4 byte value. You could use an unsigned integer in C# to represent that. Note that you do not need to do that when using built-in RPH functions to create peds, vehicles, props etc. but only when manually invoking natives. To convert a handle to its RPH representation, you can use World.GetEntityByHandle.

  • Author
3 hours ago, LMS said:

Game entities are of a handle type which is a 4 byte value. You could use an unsigned integer in C# to represent that. Note that you do not need to do that when using built-in RPH functions to create peds, vehicles, props etc. but only when manually invoking natives. To convert a handle to its RPH representation, you can use World.GetEntityByHandle.

Hi LMS, thank you very much for your answer!

 

I ended up finding out how to do what I wanted.

 

So basicaly, as stated in the NativeDB, "CREATE_OBJECT" (0x509D5878EB39E842) returns an object of type Object, which in Rage is represented by Prop type.

 

You can indeed get the spawned Handle by using Dynamic Native Call, just like this:

 

Prop _prop = Game.Natives.x509D5878EB39E842<Prop>(_objectNameString.HashCode(), _position.X, _position.Y, _position.Z, false, true, true, false, false);

 

After atributting the newly returned Object to the Type Prop, you can do anything you wish with it!

 

Best regards! 😄

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

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.