The DelPerroSands railway for FiveM on GTAV Enhanced: the game's own metro on the city line and the AERION bullet train on the big loop, with real station stops and trains that run to a timetable whether or not anyone is watching them.
Forked from Ehbw-Trains and substantially rewritten.
Credit to the upstream author for the track-node architecture and train
tracking that everything here is built on. This is the Enhanced build of
dps-trains; the sections below that
talk about dps-trains-stock, the tram and lb-phone describe that older build.
| The big loop (track 0) | 2 AERION bullet trains, half the loop apart, 28 m/s (~63 mph) |
| City line (track 3) | 3 of the game's own yellow metros, 20.1 m/s (~45 mph) |
| Freight, cable car | off |
-
The bullet train is
prompt_train_bulletby Prompt Studio (a paid asset pack). It adds one train set to the game and nothing else. Start it before this resource. Without it running, the big loop has no trains and the city line runs as normal: the bullet trains are only asked for while the pack is started, because asking the game for a train set it does not have crashes clients. -
5 December 2026, on the test server: the first boot with
prompt_train_bulletfroze the join (Invalid handle at INIT_SESSION). It is off while that is found. Meanwhile the city line runs the metros and the big loop runs two of the game's own mixed freight trains (configs/freight.lua, set 2), which pass stations without stopping. Freight is on only while the bullet pack is off. (6 December: that join freeze turned out to be in the add-on car packs, not the trains.) -
The bucket fix is built in (
server/bucketfix.lua, wasdps-bucketfix). A train is only offered to players in routing bucket 0. Anyone left in bucket 1 by a spawn or character script is moved back to 0 a few seconds after their character loads, and by a sweep every 15 seconds. Other buckets are left alone. Turn it off withset dps_trains:bucketFix 0. Do not rundps-bucketfixas well. -
/traindebug(admins, or the server console) prints every train, and now every player too: their bucket, the nearest train and its distance, and any train that has set them aside. It answers "why does no train appear". -
Station platforms are clear (
client/stationclear.lua, the train part ofdps-stationclear). The game's farm fence stands across several platforms; it is hidden at eight stations when a player comes near./clearfencehides it within 40 m of where you stand. Do not rundps-stationclearas well. -
Riding is built in (
client/ridertools.lua, wasdps-traintools). At a station next to a train,[E] Board Train. Riding:[E] Disembarkwhen the train stands,[E] Disembark at next stopwhile it moves, and you step off when it halts. Metro cars carry a few local NPC riders, and now and then a freight train has a stowaway. Metro seats come fromconfigs/metro.luaseatOffsets; freight spots are in the file./boardtrain,/disembark,/seatmark(prints the car model and your offset to the server console) and/traindoors(door parts per car). Do not rundps-traintoolsas well. -
One resource for the railway. The old DPS train helpers are being folded in here, not run beside it (Damon, 6 December 2026).
-
No
dps-trains-stock. The game's own train models only (Damon, 6 December 2026). The BigDaddy rolling stock is left out. -
One place for the train set numbers:
shared/variations.lua. The game numbers its train sets: 28 freight sets (0 to 27), then its metro at 28. Seen on DPS Enhanced on 6 December 2026:variation 28 gave engine 868868440, expected 868868440: right. The bullet train is appended after the game's own, so it should be 29 (not yet seen in game). Every train the client creates writes that line to the server log throughdps_core(rightorWRONG). If it says WRONG, set the right number inserver.cfg, withsetrso the client sees it too:setr dps_trains:metroVariation 28 setr dps_trains:bulletVariation 29
A number past the end of the game's list crashes clients, so only ever move these to a number the log has shown.
-
Doors and seats on the bullet train come from Prompt's own train script, which we do not run. Here the bullet train drives and stops at stations; boarding is
dps-traintools. -
Station announcements need
dps-voice, which is not on the Enhanced server yet. Without it, nothing is said and nothing is logged. -
game 'gta5enhanced'. The resource is nameddps_trains; the old namedps-trainsis still accepted.
Install on Enhanced:
ensure ox_lib
ensure prompt_train_bullet
ensure dps_trainsThen a full server restart and a new join: the game reads train sets only at join.
Not yet seen in game.
GTA trains in FiveM are scenery. They pass at random, they do not stop for you, and nobody can say when the next one comes. This script turns them into public transport. Trains run to a timetable, stop at every station, open their doors and wait. A player can plan a trip across the map without a car.
The railway is four resources with one job each. Only dps-trains and
dps-trains-stock are required; the other two are optional layers on top.
dps-trains-stock assets models, consists, TRAINCONFIGS_FILE
│
dps-trains engine scheduling, movement, station stops <- you are here
├──────────────────────▶ dps-traintools players boarding, seating, riders
└──getArrivalBoard()───▶ dps-transitapp passengers live arrivals on the phone
| Resource | Needs | Works without the others? |
|---|---|---|
dps-trains-stock |
nothing | yes — it is pure assets |
dps-trains |
ox_lib, dps-trains-stock |
yes, but with no custom rolling stock |
dps-traintools |
ox_lib |
yes — it works on any train entity, vanilla included |
dps-transitapp |
lb-phone, ox_lib, dps-trains |
no — it is a view of getArrivalBoard |
There is a fifth, small one: dps-traintracks. It holds extra track data and
has no scripts. See below.
On its own. With ox_lib and dps-trains-stock you get the whole service.
Light rail trains run on the city line and trains run on the country mainline.
They stop at stations, open their doors, and carry an NPC driver. Small station
blips show on the map. Staff get traindebug, boarddebug and trainspace in
the server console.
With a paid train pack (BigDaddy Trains Overhauled). dps-trains-stock is
the models and carriage sets from that pack, with the pack's own scripts taken
out. dps-trains only asks the game for a carriage set by number. It calls no
code from the pack. When the pack updates its models, copy the new files into
dps-trains-stock. The engine keeps working as long as the carriage sets stay
in the same order in data/trains.xml.
With dps-traintools. Players get an "[E] Board Train" prompt at stations, a seat on the carriage, and NPC passengers in the coaches. dps-traintools does not call dps-trains. It works on any train it can see, so you can restart it without resetting the trains.
With a paid phone (lb-phone) and dps-transitapp. Players get a Transit app
with live arrival times for every station. The app reads one export from this
script, getArrivalBoard. dps-trains never calls lb-phone, so a phone update
cannot break the trains.
With dps-voice. A rider hears "Next station, Davis" and "Now arriving at
Davis". Only the rider hears it. dps-trains sends the line to dps-voice
through its Say export. Without dps-voice there is no announcement, and the
server console logs an export error each time one is asked for.
With ox_target. The third eye shows "drive train" at the cab and "sit" in a
metro carriage. The bridge in client/bridge/ox_target.lua loads only when
ox_target is started.
With a paid cable car (rtx_cablecar). The game counts a cable car as a
train, and dps-trains deletes trains it did not create. The cablecar model
and the rtx_cablecar resource are on a protected list in
configs/general.lua, so the cable car is left alone. dps-trains calls nothing
in that script.
With dps-traintracks. That resource adds one extra track to the game.
dps-trains can run trains on it when the track number is in
config.usedTracks. Since 29 October 2026 it is not in the list, so no train
runs there now.
How the rail scripts fit together. dps-trains-stock says what a train is
made of. dps-traintracks adds track. dps-trains moves the trains and stops
them at stations. dps-traintools puts players on board. dps-transitapp
shows arrival times on the phone.
| Server artifact | 10188 or newer |
| OneSync | required — declared in the manifest |
ox_lib |
required |
lb-phone |
only for dps-transitapp |
| Game build | 3258 or newer |
useServerSetter cannot be enabled on current artifacts — the CREATE_TRAIN
native is absent, and turning it on makes this resource refuse to start. Trains
are therefore created by nearby clients; see How a train actually works.
-
Drop all four resources into your resources folder.
dps-trains-stockis ~300 MB of models — expect a first-join download. -
Start them in this order.
dps-trains-stockmust register the consist table beforedps-trainsreads it:ensure ox_lib ensure dps-trains-stock ensure dps-trains ensure dps-traintools # optional ensure lb-phone ensure dps-transitapp # optional
If they live in a category folder that is
ensured as a whole, alphabetical order already putsdps-trainsbeforedps-trains-stock— which is the wrong way round. Start them explicitly. -
Check the consist indices line up.
configs/metro.luareferences variations by number, and those numbers come fromdps-trains-stock/data/trains.xml. An index the game does not have crashes clients. The file works the numbers out from the game build: first the vanilla metro, then the custom sets counted on from it. If you add or remove a set intrains.xml, change the offsets at the top ofstartLocations. -
Reboot and rejoin. Consist data is ingested by the client at join — resource restarts do not reload it.
-
Verify with
traindebugin the server console. You should see one line per train with a node that advances between calls.handle=nilis normal for a train with no player near it.
| File | What it controls |
|---|---|
configs/metro.lua |
every running train: where it starts, which consist, which track. An entry with index = 0 runs on the country mainline. The rest run on the light rail (track 3). |
configs/freight.lua |
freight trains. Off (config.enabled = false). |
configs/general.lua |
line speed, dwell time, skipped stations, model preload list |
server/main.lua |
station names, keyed by node |
A start location is a coordinate (coords) or a node index (node). The train
snaps to the nearest track node, so spacing is exact. Use
trainspace <track> <count> to generate evenly spaced ones.
To change the number of trains, edit startLocations in configs/metro.lua.
config.count is the upper limit. It must not be lower than the number of
entries.
| Country mainline (track 0) | 3 trains, the tram set (lrt_config01 in dps-trains-stock), 23.1 m/s (~52 mph) |
| Light rail (track 3) | 3 trains, the yellow Los Santos metro (vanilla), 20.1 m/s (~45 mph) |
| Freight | off |
| Speed ceiling | 30 m/s (~67 mph) |
| Station dwell | 30 s |
| Calling points | 10 on the mainline |
All six trains are set in configs/metro.lua. The Axsellya Express (blue)
and Brown Streak (brown) sets are still in dps-trains-stock, but no train
runs them now. There is no freight service. Every train stops and opens its
doors. A freight consist stopped but never opened, which reads as broken to a
player who does not know why.
Node numbers are from data/tracks-0.lua.
462 Lumber Mill 2667 Port Depot
659 Paleto Bay 2792 Market Square (northbound only)
1464 Quarry 2925 Downtown LS (Northbound)
1701 Power Plant 3891 Quarry (return pass)
2357 Downtown LS (Southbound) 4159 Sandy Shores
Quarry and Downtown LS each appear twice because the line calls at them in both directions. They are the same station, not duplicates. Downtown LS and Market Square were added on 29 September 2026. The two older Downtown passes (nodes 2434 and 2865, named Davis Interchange on the arrival board) were removed the same day and are skipped the same way as Wind Farm.
Wind Farm (node 1555) is skipped, via config.general.skipStations. It sat
520 m from Quarry, so with braking starting 500 m out a train decelerated across
the entire gap and never reached line speed between them. Stations come from the
game's own track data and cannot be deleted — only ignored.
A train exists in one of two states, and the difference is the source of most bugs in this resource.
Ghost — no entity, just a position the server advances. This is what makes the timetable honest: a train is somewhere specific even when nobody is near it, so when you reach a platform the service is where it should be.
Materialised — a real entity, created by a nearby client. FiveM has no
server-side entity ownership for trains on this artifact (CREATE_TRAIN is
absent — useServerSetter cannot be enabled), so a train can only exist while a
player is within ~424 m to own it.
The two states must behave identically or the service falls apart:
- Ghosts advance by distance covered, not one node per tick. One node per tick on a 1-second interval is ~7 m/s, against a materialised train's 30 — the same service ran four times faster whenever somebody watched it.
- Ghosts observe station dwells too. The station cycle lives inside
if self.handle, so ghosts used to skip every platform. That made trains materialise past the station a player was standing at, and meant only observed trains lost dwell time — which is what made the fleet bunch. - Ghosts obey headway holds (2026-08-28). A held ghost simply stops advancing. Before this, a ghost could drive straight through the (usually dwelling) train ahead, swapping running order and permanently pairing services.
- Ghosts pay the braking bill. A materialised train loses ~25 s per stop to the 500 m braking ramp and the acceleration back to line speed; a ghost stops instantly, so it holds that long extra at each platform to stay on the same clock.
- Every stop is gap-regulated — ghost or materialised,
DPS_RegulatedDwellscales the dwell at the moment the stop begins: bunched trains hold up to 2× and drop back into slot, a train with an oversized gap ahead cuts to 0.4× and catches up. The old regulation only ever saw materialised trains, so the fleet ran unregulated whenever nobody was near it — which is most of the time.
Regenerate data/trains.lua whenever a consist changes. It is generated
from dps-trains-stock/data/trains.xml and tells the client which models to
preload per variation. A stale list makes the client load the wrong stock and
train creation fails with carriage hash '...' is not loaded.
Model names do not match liveries. Established in game, not inferred:
BLUE (Amtrak) streakcoaster (loco) · streakc · streakcab
BROWN streak (loco) · streakcoastercab
The coaster-named cab car is the brown coach; plain streakc/streakcab
are Amtrak stock. Pairing carriages with the similarly-named locomotive gives a
mismatched rake every time.
TRAINCONFIGS_FILE appends to the vanilla table. Vanilla is indices 0–27,
so the custom consists start at 28: 28 Axsellya, 29 Brown Streak,
30 freight (unused), 31 metro. It is registered by dps-trains-stock, not
here — registering it from this resource crashes clients on join with an
access violation inside the game's parser.
Those numbers are for a game build where the vanilla metro is 27 (builds 3095
to 3406). From build 3407 the game has one more vanilla set, so every number
moves up one. configs/metro.lua computes the numbers from the build, so the
trains follow a build change without an edit.
An invalid variation index crashes clients that are not on canary. There is no graceful failure.
Speed control is asymmetric. SetTrainCruiseSpeed sets a target the engine
works toward, giving natural acceleration and braking. SetTrainSpeed forces
velocity instantly. Applied to every change it makes trains leap off the mark
and slam to lower speeds; applied only to a commanded stop it is
imperceptible, because staged braking has the train at ~3 m/s by then. A cruise
target of zero does not stop a moving train — that single fact caused station
stops, headway holds and bunching to fail simultaneously.
Station coordinates sit well off the rails — 51 m at Lumber Mill, 76 m at Davis Interchange Northbound even at closest approach. A pure distance test for "at the platform" is unreachable at some stops, so the trigger also matches the station node, within 1 node and only on the approach side (was 5 nodes / 22 m, which parked trains up to ~35 m short of city platforms — by trigger time staged braking has the train at 3 m/s, so the 1-second server sampling covers ~3 m per tick and cannot step over the window).
Private fields are not writable from outside the class. server/main.lua
cannot assign to train.private.*; doing so throws and aborts that pass of the
update loop. Headway holds and dwell regulation both did this and had never
executed successfully. Keep per-train flags in module-local tables keyed by id.
30 m/s is a hard ceiling. CTrainGameStateDataNode cannot represent a
higher cruise speed, so anything above it desyncs trains between clients
regardless of unlimitSpeed. Note server/main.lua reads
config.general.defaultSpeed, not config.freight.speed.
Reboot rather than restarting the resource. There is an onResourceStop
handler that deletes this resource's trains, but data-file changes
(TRAINCONFIGS_FILE, VEHICLE_METADATA_FILE) are cached and need a full boot
plus a client rejoin.
CfxLua syntax (backtick hashes, +=) appears throughout — vanilla luac
cannot parse these files, so mask before syntax-checking:
sed 's/`[A-Za-z0-9_]*`/0x1234/g; s/+=/=/g; s/?\./\./g' file.lua > /tmp/x.lua
luac5.4 -p /tmp/x.lua- Headway hold — a train within 40 nodes of the one ahead stops until the
gap clears. Applies to ghosts too (they hold by not advancing), and the hold
is visible on
private.headwayHoldviaTrain:SetHeadwayHold, so the arrival board can show "delayed" and the speed logic cannot fight it. - Physical separation — removed. It held a train whenever another was
within 60 m on the ground, but track 0 folds back on itself and the check
could not tell a legitimate parallel pass from a head-on one, so it stopped
trains dead every time services met on adjacent rails. The pass-through it
guarded against was actually the node-4226 stranding bug, fixed at source in
getClosestTrackNodeWithinRange; same-direction following is covered by the headway hold. - Stranded-train recovery — a materialised train that has not advanced for 120 s is culled and respawned. Trains within 40 nodes of a station are exempt: the ghost dwell happens before materialisation, so a train can be legitimately stopped at a platform with no dwell flag set.
- Orphan cleanup —
onResourceStopdeletes this resource's train entities. Without it every restart left untracked trains running that ignored every command, because the rogue sweep only culls trains missing thee_trnstate bag and an orphan still carries it.
traindebug |
every train: id, type, track, node, handle, dwell (mat and ghost), hold, coords — plus a per-track gap table vs the ideal spacing (the one-line health check for bunching) |
boarddebug |
arrival-board internals: stations, cumulative distances |
trainspace <track> <count> |
evenly spaced node coordinates for start locations |
setr ox:printlevel:dps-trains debug |
verbose lifecycle logging |
handle=nil means ghost, a number means materialised. traindebug gives
positions as node indices. CTrain derives currentCoords from the node,
so spacing is exact rather than eyeballed off a map.
/trackprobe (in game) prints which train tracks the game engine has loaded to
the server console. Use it after adding track data.
dps-trains-stock |
rolling stock, consists, station builds, TRAINCONFIGS_FILE |
dps-traintools |
boarding, seating, ambient riders, /traindoors |
dps-transitapp |
Los Santos Transit — live arrivals on the lb-phone |
dps-traintracks |
extra track data, no scripts |
-
5 December 2026. DPS Enhanced, 2.0.0. Runs on GTAV Enhanced. The big loop runs two AERION bullet trains (prompt_train_bullet); the city line runs three of the game's own metros. dps-trains-stock is not used. Train set numbers moved to
shared/variations.lua, settable from server.cfg, and every new train logs whether its number gave the right train. Station announcements are skipped when dps-voice is not running. -
12 November 2026. Station names put right. Every metro stop now carries the game's own station name, the same name the HUD shows. Five stops were named for the wrong place (for example, Puerto Del Sol was announced as Little Seoul), 11 of the 21 stops had no name, and Davis was missing. Both platforms of a station now share its name. On the country line, Paleto Bay was keyed to the wrong stop node and so had no name. The list was checked stop by stop against the nearest game station.
-
10 November 2026. Train list updated for the stock now running.
-
2 November 2026. The light rail runs the Rags metro set. The country line calls at five passenger stops only: Sandy Shores, Lumber Mill, Paleto Bay, Downtown Los Santos and Market Square.
-
12 November 2026. README: what it is for, how it works alone and with paid scripts, other DPS scripts.
-
1 November 2026. The yellow metro runs the light rail and the tram set runs the country mainline. Station announcements follow the line you are on, so swapping trains between lines changes nothing. Roxwood Junction is no longer a mainline stop.
-
31 October 2026. One shared station list (
shared/stations.lua) for the client and the server. Station announcements are spoken through dps-voice. Consist numbers are worked out from the game build (build 3570). -
29 October 2026. The Roxwood line is off: track 12 is out of
config.usedTracksand the Roxwood shuttle no longer spawns. Tram consist added. -
4 October 2026. Trains reverse at a terminus. Only tracks the game has are enabled.
/trackprobeadded. -
29 September 2026. Downtown LS and Market Square stops added. The old Downtown stop removed. Regional line speed set to 23.1 m/s.
-
22 September 2026. Metro seat map rebuilt: 18 seats along both walls. Gentler departure from stations.
Made by DaemonAlex for DelPerroSands.
The engine is forked from Ehbw-Trains by Ehbw. The
rolling stock in dps-trains-stock comes from Trains Overhauled by Big Daddy.
All of these are made for DelPerroSands and run together on one Qbox server. Each one works on its own. The ones marked "pairs with" do more when both are running.
| Script | What it does |
|---|---|
| dps-inventory | The inventory: ox_inventory with equipment slots, backpacks, armour plates and a self status panel, in the DelPerroSands colours. |
| dps-medical | Patient records, illness and diagnostic tests. A companion to wasabi_ambulance. Pairs with dps-inventory: symptoms and diagnoses show on the status panel. |
| dps-insurance | Ties m-Insurance into the MDT, impound, hospital and medical chart, and raises premiums for incidents other scripts report. Pairs with dps-medical and dps-fuel. |
| dps-studio | Build rooms, doors and portals in game from one panel (/studio), with owners and managers so staff do not have to support them. |
| dps-shops | Shop clerks who greet, react to robberies, talk back through dps-ainpcs and remember trouble, plus player-owned stores with delivery runs. Pairs with dps-ainpcs. |
| dps-fleet | Vehicle browser and workshop on one panel: extras, liveries and mods for emergency vehicles. |
| dps-parking | Parking with valet, impound, violations and reserved spots. |
| dps-vehiclepersistence | Vehicles stay where they were parked. Pairs with dps-parking. |
| dps-towjob | Queue-based tow job with jg-mechanic integration. |
| dps-services | Request a tow and follow it live on the lb-phone and lb-tablet. Pairs with dps-towjob. |
| dps-autoshops | Self-service repair shops when no mechanic is on duty. |
| dps-cityworker | City infrastructure job and career. |
| dps-ainpcs | NPCs you can talk to, with trust, quests and intel. Other scripts can make their own NPCs talk (dps-shops clerks). |
| dps-badpeds | Police interaction with NPCs: stops, arrests, intel and jail records. |
| dps-gangwars | Ambient gang NPCs, territory population and war reinforcements. |
| dps-rotations | Moves dealers, harvests and other spots on a fixed schedule. |
| dps-transitapp | Live train arrival boards on the lb-phone. |
| dps-faceplant | City help, reports and staff tools on the lb-phone and lb-tablet. |
| dps-chat | A command box for voice-only servers. No chat feed. |
| dps-filmmode | One key hides every HUD layer and gives a smooth free camera for recording. |
| dps-fuel | Gas station drive-offs for the ox_fuel nozzle: ripped hose, pump fire, station camera and a police call, by odds. Pairs with dps-insurance. |
| dps-voice | Spoken lines for NPCs, station announcements, dispatch and shops, from local voice models first. Pairs with dps-ainpcs. |
| dps-bags | Real bags for ox_inventory: the bag you carry shows on your character. |
| dps-items | Item rules for ox_inventory: locked items, glovebox seats and an exploit watch. |
| dps-furniture | Puts streamed furniture packs into the qs-housing furniture shop. |
| dps-shellbrowser | Staff tool to look at every qs-housing shell and set its door. |
| dps-signs | Rotates city messages across the SmartSigns road boards. |
| dps-stationclear | Hides map props that are in the way and keeps stray game peds off chosen spots. |
| dps-citymap | A ready-made map of the whole city, cut into tiles for in-game screens. |
| dps-cayo | Switches on the game's own Cayo Perico island, and nothing else. |
| dps-aviation | Flight behaviour: aircraft idle instead of cutting out, sane taxi speed, a real start sequence. |
| dps-airlines | Airlines job: passenger flights, cargo, charters, flight school and maintenance. |
| dps-traintools | Rider tools for trains: board, sit, get off at a stop, ambient passengers. Pairs with dps-trains. |
| dps-trains-stock | Train models and carriage sets for the train system. No scripts. Pairs with dps-trains. |
| dps-traintracks | Extra train track data. No scripts. Pairs with dps-trains. |
| dps-crossings | Level crossings that close when a train comes. Pairs with dps-trains. |
| dps-transit | Passenger rail planning and scheduling (older system; dps-trains runs today). |
| dps-maritime | Dock work and boat deliveries with progression. |
| dps-maritime-maps | Map files for the Jetsam docks, the map half of dps-maritime. |
| dps-proracing | Circuit racing with lobbies, an AI practice grid and lap times. |
| dps-carmenu | Staff vehicle browser and spawner over the live Qbox vehicle list. |
| dps-clothingbrowser | Staff tool to browse, identify and export clothing and uniforms. |
| dps-lootpeds | Loot dead NPCs, with loot tables per model. |
| dps-hookers | Adults-only RP (18+), adapted from MH Hookers by MaDHouSe. |
| dps-weatherbridge | Lets qb-weathersync and Renewed-Weathersync scripts work with night_natural_disasters. |
| dps-fixes | Small server fixes kept in one resource. |
| dps-bucketfix | Puts players back in the main world after spawning. |
| dps-unfocus | One key that frees a player stuck in a menu. |
| dps-welcomecam | Aims the first camera a new player sees. |
| dps-handlingdump | Developer tool: saves the stock handling of every vanilla vehicle. |
| dps-weaponsounds | Custom weapon sounds (planning; no code yet). |
| dps-events | Playtime reward events (planning; no code yet). |