[RELEASE] FiveM Freight train (AI) and enterable trams (as passenger) (Suited for Roleplay to)

Like my post already states at the top:
NOTE: Mine is abandoned! an no longer being worked on by me!
You can still use mine if you like, but it has known bugs (as listed bellow), and
isn’t marked as 100% finished either yet!

I have stopped working on FiveM or GTA V scripts for over 4 years now, and lots has changed with FiveM, so compatibility is highly doubtful due to the many changes which FiveM kept implementing, the fact that a lot of stuff was still in development or research when this train system was build/experimented with, and then there is OneSync (which is even a completly different system, of which I don’t know if this script is compatible).

But with just a simple “Crashes my game as soon as i load in”, nobody will be able to help you at all :wink:

IF people are able to help out they need a decent crash report/log or at least more information like:
What server are you running on, what version/release are you running on (are you for example forcing it to run a previous DLC, or the latest one etc). What are the frameworks or possible other conflicting scripts you are using etc.

Maybe with a bit more information like that others might be able to help you, I unfortunately can’t help anymore since I don’t do anything with FiveM at all anymore.

Maybe someone even has a new/better version by now which does what mine did :slight_smile:

I have a question, am I able to put the metro on ymap tracks that were custom made, or will it only specifically be able to work on the rails inside the game?

Honestly? This system doesn’t work decently at all (anymore). It literally has been years since I used it myself, or since I have looked at it.

All this has been said in the main post though (shown in bold even), please read the main post to see the issues, and where to find a (possible) newer version of someone who took over from me (if he’s still working on it though).

My friend! Got everything working but the option to stop and board the tram. (I got it working once somehow someway hours ago but haven’t been able to get it since. What is the functionality to do so? The damn subway just keeps going.

  • Daniel

Hey Daniel,

Like mentioned in my previous reply to someone else and stated in the main post, this script is VERY outdated and quite problematic (by now). I personally recommend not to use it at all anymore to be honest (I myself haven’t for years, and neither have I worked on it for years anymore).

In the main post I have linked to someone whom took over and ‘upgraded it’, but I will have to be honest: I don’t know how far he got, don’t know what he changed and if he still maintains it.

The stopping of the trains however was never part of this script. I used ‘forced spawned trains’ which ran using the game engine itself. However it turned out that when more and more people joined the server that it could become VERY problematic due to the game engine and the way it handles the train/traffic system.

It would for example cause several trains to spawn at the same time, it would cause trains to suddenly despawn and more of the alike.

So IF you got it working, please keep this in mind, because in my personal opinion it would be a much better solution to just enable the main trains/tracks while not letting this script manage the trains themselves :slight_smile:

1 Like

It saids the last time he logged in was middle of 2022 … not gonna work. We need someone else now who knows more on what to do. Cause thats no bueno!! 100’s of other servers already have it working, but a little unfair nobody has come forth except you guys and it’s been limited support…

Hold on, I will download it from github, and see if it can ‘remove the crashing code’

And implement the ‘snippet’ I just added to the main post.

That however should not fix all problems, BUT I expect (NO PROMISES THOUGH!) that It would solve most problems

DO NOT KNOW however if the ‘standard railroad track activation’ will also cause the trains/metro’s to stop at stations, you’ll have to try that yourself if you don’t mind.

BUT do please also keep in mind: This is not ‘official support’ and does not mean I’m “back at this script” for maintaining it again :wink: :slightly_smiling_face:

I have since moved on from the regular FiveM servers onto other larger projects (not FiveM related), and thus have very limited time… but will take a quick glance and see what I can do.

1 Like

Thank you so much!! I have been trying to ride the actual subway for 3-4 hours now trying to figure this out lol. I even jumped in front of the train to try and stop it… should’ve known better lol

On another note, how do you change the vanilla train (freight train) to something like a “bullet train” model ? I’d imagine that’s an easier task but I’ve never done it.

Np, I have the trains working now (enterable and stopping) activating the native system…

However I now need to figure out a way to automatically give players a 1 star wanted level when entering a train without a ticket… (since the doors are now automatically opening and closing also).

However it has been quite a while I messed with FiveM, so I’m trying to find some natives for it (not all respond as you might expect, so please hold on a bit longer).

For the model change you would have to stream a new train model to replace the old one, but that’s a whole different story though :wink:

I would recommend searching the forum for something like: Streaming custom vehicles :slight_smile:

Goated . Appreciate that!! We’re looking for your new download link! lol

I think I found a few forums that mention changing the vanilla model to use your own, but I’ll see if I can handle it first lol. since it appears its an old model which use the DLC files.

It seems to be working now…

Adaption made (still testing it a bit): Ticket will now automatically activate when entering the metro, and invalidate once you leave it again (SO EVEN AT THE SAME STATION THOUGH!)

Not sure if it’s 100% fool proof, but seems to work. I however don’t have much time to spend on this, but I’m guessing that you or someone else might work on from it once it’s updated again :slight_smile:

Still doing some small tests quickly, and then I can upload it again.

BUT YET AGAIN: It’s a one-time-update, it will not receive further support due to the massive lack of time I have :slight_smile:

1 Like

Your time is appreciated and we wait here for you. Thank you!!
Good luck on all your new projects aswell!

1 Like

It has been updated now.

I have tested it (A BIT!!) and seems like it’s working with the new system now :slight_smile:
Trains do stop, get detected, tickets are validated and invalidated and a wanted level is given after boarding without a ticket (after the player has been warned to leave the metro first) :slight_smile:

You can download it from the github again.

NOTE: REMOVE THE OLD VERSION FIRST! This is a complete ‘re-do’ of the old version

1 Like

Is it possible to add custom trains to this?

1 Like

That was my question too… since I want to use my “bullet-train” model. I believe it was something about “streaming” the model. [How-to] Stream vehicles/models from server to client

If you would want to replace trains then you should indeed be able to stream “replacement vehicles”. If you would want to add additional trains then it becomes a whole different story though.

However: This script does not do anything (anymore) in regards of controlling, spawning etc the trains. It just enables the default game trains and make use of the models spawned by the game.

If you add additional trains, you will need to adapt the script to recognize the new model name(s), this should not be a problem if you only replace the trains.

I’m however not going to be able to help with this because:

  1. It’s been AGES since I’ve worked seriously on my own FiveM stuff (Aside from this update due to many requests)
  2. I have never ‘messed’ with the trains and the train models (only cars).
  3. There are plenty of topic on how to properly stream vehicles (which is literally a topic on it’s own) :slight_smile:
1 Like

I hope the update is working properly for you now btw? :slight_smile:

1 Like

Yessirrr!! Since you’ve stepped away I’m currently pushing towards getting that damn bullet train of my dreams in my server. that will be a game changer! I did however find another script that closed the door and you couldnt fall out for the subway issue you mentioned… however … you couldn’t get out at all … the script kept saying the locations but then wouldnt stop LMAOOO. but yes! works perfectly, and thank you for your contributions for your time in fivem!!

  • Dan
1 Like

Thanks :slight_smile:

One small note on scripts that actually “mess with”/“control” the trains (which most likely also spawn them in someway): Those scripts (which mine was actually one of tbh) will most likely cause MASSIVE issues with trains despawning, not appearing, our even cause multiple trains spawning (often these issues occur when multiple players are active on the server).

So please be careful when using such scripts… It’s a very technical story to explain why that happens, but it basically comes down to which player is the ‘host’/‘spawner’ of the trains, and if other players can’t “detect” your trains properly it can all go ‘haywire’ quickly.

Mine SHOULD not have that issue anymore now because it’s using the regular game trains. IF something happens now: Blame R* :stuck_out_tongue: haha

1 Like

Thank you a lot for updating the script.

I played around with it a bit and i moved the spawning of the trains to the server-side. Still testing if this actually syncs the trains between players or not.

But because you mentioned the ticket-system. The reason you didn’t find the ticket props on the “upside” stations seems to be, that the whole station itself is a prop.

dt1_21_station

And i tried adding that and it didn’t work :smiley:

So… TLDR.

Thank you for updating, even though you stopped doing so.