[Release] TrainSportation ~ Drive & Be a Passenger in a train!

Yes no problem I will get some video of this today. Thanks

:+1: Awesome, looks like everything is working for you.

Does anyone know how to make the markers only usable for a specific job? (I’m using ESX)

1 Like

Sure. Start learning Lua and ESX structure. That’s the best way to make anything you need and want without waiting for someone to do it for you. I am talking without any sarcasm. You’ll thank me later.

Maybe make spped of train = 0 in a loop, if there’s no driver?

I don’t know of a efficient way to do this. We can’t get every train, or a train even near you. The only way to get a train is to spawn it and capture it’s ID that is returned, or to use ray casts (Shoot an invisible bullet and get the first thing it hits)…

If networking worked with trains it would be easy, but it doesn’t. If I did it for the trains you spawn in now, when you disconnect it would start doing it again.

You just put every spawned train (as an entity) into a table on server side and go through it in a loop checking for driver. If none - set speed to zero

Only if it were that easy, doesn’t work that way. Server handles syncing players. The client handles the world. Gta networking is peer to peer (or something like it) anything you spawn on your client is owned by the client but shared with everyone else.

You could send the id to the server of the train, the server cant do anything with the id. If networking worked with trains you could send the netid to the server to tell the other clients to do it but I can’t get the netids of trains always returns 0.

Update:
You no longer have to restart the resource. The problem has been resolved!

Is there a way to make it so the train drives and stops by itself?

Leave the train alone the ai should take over and drive it.

Ohh okay, and I set allow ped as pas to true in the config to allow others to get in, is there anything else I need to do?

:o don’t have to do that, it’s a switch to check if you are inside the train as a passenger leave it at false!

It won’t let me get in as a passenger.

Try re-downloading I updated it last night twice. If someone is inside the driver seat it will put you in as passenger. But someone has to be driving it for that to happen.

Hi, nice mod but if you spam G it will duplicate train. Just a heads up.

any-chance of making the freight train longer like a real freight train?

In the train config change the trainid to something else! Don’t go above the trainid of the trolley or it crashes I think. Trains spawn in variations so you cant really control what each cart is. Each id spawns a variation that will always stay the same I believe. Try trainid 1 I think its longer…

thank you i will give this a try tomorrow. any longer then 5 cars will be better. thats all i know