[ESX, Standalone] FiveM Trains, Works with OX inventory and target system

This is exactly why I had abandoned my FREE script which @Ethan4t0r suggested.

Mine DOES NOT WORK as intended either.

BOTH due to game engine limitations/issues I had back in the day, and with OneSync indeed for the entity radius and such.

There is a VERY simple way to get trains on your server (for free) and native by the game though, and that is simply adding:

		SwitchTrainTrack(0, true) 					-- Main train track(s) around LS and towards Sandy Shores 
		SwitchTrainTrack(3, true) 					-- Metro tracks 
		SetTrainTrackSpawnFrequency(0, 120000)		-- The Train spawn frequency set for the game engine 
		SetTrainTrackSpawnFrequency(3, 120000)		-- The Metro spawn frequency set for the game engine 
		SetRandomTrains(true)						-- Telling the game we want to use randomly spawned trains end)

To one of your client scripts, and voila you’ll have trains riding around in your game.

NO, obviously you don’t have tickets etc then, but honestly:
With the current issues it’s providing in the engine itself and with network syncing:
Such systems are just useless, and definitely not fair to ask money for without proper testing to at least guarantee 95% stability and functionality. But that’s just my ‘two cents’

4 Likes

Will it enable trains? Sure
Will it be stable? No
Will players have the same trains? No
Will it sync correctly? No
Will there be multiple trains per player? Yes.

Due to how OneSync infinity works, it’s physically impossible for this not to happen, because the train entity does NOT have persistence. And at the moment, it’s impossible to make it persistent, without the aid of highly experimental and unstable natives

1 Like

Yes i know, which is why I also replied to your post (because you described the problems perfectly to the OP/seller).

People want (simple) trains and not spend money on it? just enable the railroads and don’t expect anything fancy from it (like the tickets).

Another note from my personal opinion: I find it utterly ridiculous that these mods can/will be shared as closed source (presumably DLL) files without having any insight into the source code at all, by sellers whom don’t even know how to properly setup (FULL) test scenario’s, doe QA Testing and such (which isn’t meant as insult at all, but as a serious security concern).

So basically they are selling a product where the server owner could not ever see what they are doing on his/her server due to it being closed source, can’t look into sources to see if they made crucial (security) errors/mistakes and more of the alike…

3 Likes

Would this approach allow users to be able to ride the trains (without tickets) or would this just result in trains being actively travelling around the map?

EDIT: sorry, I just read Mycroft’s comment indicating that it will not sync correctly

It would indeed not make them stop and enter players. It would basically just be the ‘single player trains’ if I’m correct. Im currently using them on my own server and didn’t had any problems with syncing or so to be honest.

HOWEVER to be fair: We don’t pay much attention to the trains (anymore), and every now and then it’s just something like; “Ow cool, there’s the freight train” or “hey, stop, we need to let the tram/subway pass”. But that’s about it.

We didn’t had any issues like double trains spawning or things like that.
NOTE: We are NOT running onesync at the moment btw.

1 Like

" Known issues(IMPORTANT)

Script is cause crashes when online is > 20"

Lmao selling something, that is known to cause crashes? :smiley:

Just to inform others, script is only ESX and not optimized at all.

These are results of running it.


The reportings are in idele

2 Likes

will it be on qbcore and will it be optimized?

I don’t think so, look messages in the up with all screenshots.

Use this one

2 Likes

Thats train driving script I need auto trains with ticket system :slight_smile:

It not will be on qbcore, sorry

QB version of FiveM trains is now available here!

UPDATE!

Optimized to 0.02 ms
More config parameters, now you can configurate server part

Update

Added an next station/current station interface. This option can be disabled in config.

Update

Added an option to config, disable metro trains/freight trains.

Update

Fixed an bug with notification not appearing

Added to our script test server

Open Source package is now available HERE [20$ + Taxes]