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

roleplay
lua
trains
github

#1

Working so far:

  • Spawn Trains with (G) inside the green maker (Two markers for both trains, Requires Config.Debug to be true)
  • Enter Trains as Driver (F)
  • Two types of trains with different speeds/accelerations
  • Able to enter Trolley as passenger. It will teleport you in the back of the Trolley.

Todo:

  • Fix being able to get into a trailer the train is pulling. :dizzy_face:

Description:
TrainSportation allows you to drive trains, as well as spawn them at the locations marked with a T IF Config.Debug is true. This resource will soon let you enter a Trolley as a passenger, but for now lets you drive them.

Keys:

  • G = Spawn train while in Green circle/marker (Need Config.Debug = true in config.lua)
  • F = Enter/Exit (Your Ped has be looking at the train.)
  • W = Push Accelerate Lever Forwards
  • S = Pull Accelerate Lever Backwards
  • X = Set Accelerate Lever to stop, and E break
  • W+S = Debug instant stop. (requires Config.Debug = true)
  • KP8 = Delete train ped is looking at.

How-To:

  1. Spawn a train (Use Config.Debug = true, or another resource to spawn a train)
  2. Go to the front of the train, look at it, then Press F (Make sure it’s the drive-able part of the train, otherwise you might end up inside a trailer.)

Networking:
This resource doesn’t use any networking. Instead it uses ray casts to get into the train.

Download:
https://github.com/LexTheGreat/TrainSportation/archive/master.zip

Images:


Trains in FiveM
[Unsupported] Driveable Trains
How can i stream trains
Can someone make this work with FiveM
Train on a track
[Release] TrainJob ~ Simple Job using TrainSportation
#2

How effective is this? I never thought of doing that but it doesnt seem half bad


#3

Train just vanishes every time.


#4

Works fine. Gets the train every time.

You have any other resources? Recuse this doesn’t delete trains, unless you are looking at it and pressing KP8. Something else is deleting your trains.


#5

After 50 tries i got inside the train but not able to drive it. But it does seem to vanish alot for some reason while trying to enter. This is a clean version of the server with no other scripts.


#6

I’m using it on a clean sever just fine. Can you send me your logs?


#7

Lex, I tested this out and I was able to drive the train as two different clients so your method does appear to work. I’m sitting in the train for about 5 minutes now and I even disconnected the user who spawned the train and it didn’t despawn.

One thing I noticed that was a weird behavior was that once I spawned the train and left it. The train started driving by itself. Once I stepped back on the train it was fine.


#8

Awesome!

No idea how to fix this lol! The AI takes over if nothing is driving a train…


#9

have blips on map, but no markers in game and G dont work. What am I missing?


#10

(If the circle is not visible reload the resource I had this happen to me a few times…)

I have to find out what is causing this. In your server console type ‘restart TrainSportation’ without the 's


#11

Yep works like a charm once you restart the resource…


#12

Lex how can we get the train horn to work? I think that would be cool.


#13

Press E? I thought it already worked :o


#14

If the player is actually inside like, driving the vehicle, the horn works like any other, no changes needed


#15

Yes Sorry just seen that… Any future updates like making actual stops or able to charge people to ride the train? Making it an actual job?


#16

No, if any server wants to use this they can! It shouldn’t be that hard to make a job and include this resource. As long as a train is spawned, this resource will let you get into it as a driver, or passenger. :+1:


#17

lol it works fine by yourself, as soon as a few people get on… forget it lol


#18

What do you mean? :o


#19

if people are around its bugs out and lags bad…


#20

What do you mean by bugs out? Let me know if you are having problems with this and I’ll look into it.
I need to know what the problem is to fix it though. D: