This unfinished resource is no longer being developed and has been recreated into a working resource at [Release] TrainSportation ~ Drive & Be a Passenger in a train!
Warning: This isn’t a finished project, just something to learn from.
- There is potential for trains to be used in RP Jobs, or other stuff.
- There is a problem with trolleys, the doors open but there is invisible barrier .
- Maybe you could teleport the passengers into the trolley?
- I’ve differentiated the speeds for the trolley and regular train. The Acceleration is also differentiated https://github.com/LexTheGreat/DriveableTrains/blob/master/client.lua#L93
- I couldn’t find a way to get the nearest train so it uses the return of the CreateTrain function, sends that to the server, then the server sends that to everyone else so they can find the nearest train by position. If there is a better way please let me know ;-; I used ray-cast as well as nearest-vehicle.
If you load the resource there are two places the trains spawn
247.9364, -1198.597, 37.4482 – Trolley
670.2056, -685.7708, 25.15311 – Train
Press G to spawn trains, make sure it’s loaded by pressing F8, should say loaded keys.
If you need to restart this resource, press KP8 and it will clear out the trains. If you don’t do this the server will loose track of the trains, and you will have to restart to get rid of it.
F = Enter Exit
W = Accel Forwards
S = Accel Backwards
X = Debug Instant stop 200mph -> 0 instantly
F8 = Fivm’s console
Oh, if you get out of the train when next to a spot that it stops at by default (Trolley stops at the train stations) It will start to go around the track by it’s self. There is no driver but it still goes…?