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.

CREATE_MISSION_TRAIN

Featured Replies

  • Author

yeah i was just doing that since the same happened to me :p

Looks like reffering to the handle doesn't work though, atleast not for DELETE_MISSION_TRAIN

  • Replies 52
  • Views 5k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • alexguirre
    alexguirre

    This worked for me: new Model("freight").LoadAndWait(); new Model("freightcar").LoadAndWait(); new Model("freightgrain").LoadAndWait();

  • This thread escalated faster than i thought :)

  • Your weekend??? What about my night, I should have never brought it up :p

Posted Images

@khorio you need to pass a pointer, so instead of passing only "handle", pass "new IntPtr(&handle)" and after this the handle will be set to 0. You need to do this in unsafe context so enclose you code with "unsafe { }" and you might need to allow it in the project properties. The same for SET_MISSION_TRAIN_AS_NO_LONGER_NEEDED.

  • Author
2 minutes ago, alexguirre said:

@khorio you need to pass a pointer, so instead of passing only "handle", pass "new IntPtr(&handle)" and after this the handle will be set to 0. You need to do this in unsafe context so enclose you code with "unsafe { }" and you might need to allow it in the project properties. The same for SET_MISSION_TRAIN_AS_NO_LONGER_NEEDED.

Learning new stuff, thanks :)

Passing just the handle for controlling the speed apparently works though.

1 minute ago, khorio said:

Learning new stuff, thanks :)

Passing just the handle for controlling the speed apparently works though.

Not all natives need a pointer, notice the parameter in DELETE_MISSION_TRAIN(Vehicle *train), it has an asterisk, that means that it needs a pointer.

  • Author


Error    CS0212    You can only take the address of an unfixed expression inside of a fixed statement initializer  

Guess I'm still doing something wrong

31 minutes ago, khorio said:


Error    CS0212    You can only take the address of an unfixed expression inside of a fixed statement initializer  

Guess I'm still doing something wrong

Huh, I remember this happening with other things I worked on, try making a copy of the handle before calling the native, pass the copy and finally set the original handle value to the copy one in case the native has changed the value.:

uint handleCopy = OriginalHandle;
Native.Call... new IntPtr(&handleCopy)...;
OriginalHandle = handleCopy;

 

Edited by alexguirre

38 minutes ago, alexguirre said:

Not all natives need a pointer, notice the parameter in DELETE_MISSION_TRAIN(Vehicle *train), it has an asterisk, that means that it needs a pointer.

I've never had to use pointers for natives, even those with an asterisk. Just using the ref keyword seems to work in my experience, e.g. 

// definition from nativeDB: SOME_NATIVE_NAME(param1, *param1)

NativeFunction.Natives.NATIVE_NAME(thing1, ref thing2);

Perhaps it doesn't work in all situations, but it's worked fine for me so far everywhere I've encountered that. 

[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
Just now, PNWParksFan said:

I've never had to use pointers for natives, even those with an asterisk. Just using the ref keyword seems to work in my experience, e.g. 


// definition from nativeDB: SOME_NATIVE_NAME(param1, *param1)

NativeFunction.Natives.NATIVE_NAME(thing1, ref thing2);

Perhaps it doesn't work in all situations, but it's worked fine for me so far everywhere I've encountered that. 

That's nice to know :)

You must be a happy camper now, here are your trains :)

4 minutes ago, khorio said:

That's nice to know :)

You must be a happy camper now, here are your trains :)

Hahaha. I'm not even home from work yet, but hopefully sometime this weekend I can check it out. :thumbsup:

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

3 minutes ago, PNWParksFan said:

I've never had to use pointers for natives, even those with an asterisk. Just using the ref keyword seems to work in my experience, e.g. 


// definition from nativeDB: SOME_NATIVE_NAME(param1, *param1)

NativeFunction.Natives.NATIVE_NAME(thing1, ref thing2);

Perhaps it doesn't work in all situations, but it's worked fine for me so far everywhere I've encountered that. 

I think that ref only works using the dynamic Natives, not sure.
I'm more used to the CallBy methods and the new IntPtr(&handle) is how is done in the RPH examples and how I learn it, and when you only need to get values(i.e. a native to get a color) you can use &value only.

Just matter of preference, anyways the ref keyword is the C# way of passing pointers.

1 hour ago, khorio said:

Now @LtFlash has to update his Transportation mod :P

Hah, that was my 1st thought. I need to check where are the junctions are though. It's disappointing that we can't change the state of any junction on the map but what we can do about it. Shame on you, Rockstar xD

Tracks positions are described in files in \common.rpf\data\levels\gta5\trains1..10.dat

Edited by LtFlash

  • Author
1 minute ago, LtFlash said:

Hah, that was my 1st thought. I need to check where are the junctions are though. It's disappointing that we can't change the state of any junction on the map but what we can do about it. Shame on you, Rockstar xD

Tracks positions are described in files in \common.rpf\data\levels\gta5\trains1..10.dat

  • void SWITCH_TRAIN_TRACK(int intersectionId, BOOL state) // FD813BB7DB977F20 68BFDD61

This? or isn't that what you mean

3 minutes ago, khorio said:

This thread escalated faster than i thought :)

TRAINS!!!!

lcpdfr.com converts from whacker forum to foamer forum in 3... 2... 1... 

Also, can I suggest that as we figure this out, maybe we could create an open source Trains project which could be on GitHub? That way everybody could benefit from the development. 

Edited by PNWParksFan

[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
34 minutes ago, PNWParksFan said:

TRAINS!!!!

lcpdfr.com converts from whacker forum to foamer forum in 3... 2... 1... 

Also, can I suggest that as we figure this out, maybe we could create an open source Trains project which could be on GitHub? That way everybody could benefit from the development. 

Sure, why not. All I'm really interested in at the moment is how to load this train chock full of explosives :)

3 hours ago, khorio said:

All I'm really interested in at the moment is how to load this train chock full of explosives :)

And that, ladies and gentlemen, is how you end up on a list at a three-letter agency. :P

[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
Just now, PNWParksFan said:

And that, ladies and gentlemen, is how you end up on a list at a three-letter agency. :P

Hah :)
Looks like you haven't played any of my callouts, i might as well rename it to "It goes BOOM!" 

If i can derail a train in the middle of los santos and create a massacre that blows bits off 200 peds into blaine county I will :p

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.