Trains (The Big Daddy Version)
The resource includes:
- Automatic freight, passenger, and metro service
- Player-spawned and player-driven trains
- Configurable routes, consists, stops, dwell times, acceleration, and braking
- Passenger boarding positions and one-use tickets
- Metro station announcements and distance-based train audio
- Automatic crossing horns, crossing barriers, and ambient traffic control
- Train, station, and stop blips
- Configurable station peds and props
- In-game consist, stop, and passenger-position editors
- Optional framework payments, target-system support, fare-evasion calls, and ACE permissions
POPULAR LINKS
- BUY IT! Purchase Trains from BigDaddyScripts.com
- SERVER.LUA General Big Daddy Scripts framework-integration guide
- PERMISSIONS ACE permission setup guide
{:links-list}
INSTALLATION
- Extract the downloaded product.
- Place the complete
BigDaddy-Trainsfolder in your server's resources directory. - Open
settings.iniand enter your product key under[licensing]. - Review the automatic-train, driving, ticket, and permission settings before starting the resource.
- If
useMoney=true, configure the framework near the top ofserver.lua. - If you want fare-evasion calls sent to a CAD, configure
server.911.lua. - Add the resource to
server.cfgafter its required framework resources:
ensure BigDaddy-Trains
DO NOT RENAME THE RESOURCE
The folder must remain named
BigDaddy-Trains. Renaming it prevents the resource from loading its configuration and licensed components correctly.
{:is-danger}
REQUIREMENTS AND OPTIONAL INTEGRATIONS
The resource is standalone unless you enable an integration:
| Integration | Required? | Purpose |
|---|---|---|
ox_target or qb-target |
No | Adds target interactions to configured ticket machines |
| NAT, QB, ESX, ND, or BigDaddy-Money | No | Charges players when useMoney=true; the QB bridge requires qb-core exports |
| BigDaddy-LocalsCall911, Sonoran CAD, Imperial CAD, SnailyCAD, or custom code | No | Receives metro fare-evasion calls |
When neither supported target resource is running, ticket machines still work through the built-in proximity prompt.
QUICK START
A typical automatic-service setup looks like this:
[licensing]
key1=YOUR_PRODUCT_KEY
[settings]
UseAcePermissions=false
AcePermission=
AutoSpawnFreight=true
FreightSpawnIntervalMinutes=15
MaxFreightTrains=1
AutoSpawnPassenger=true
PassengerSpawnIntervalMinutes=20
MaxPassengerTrains=1
AutoSpawnMetro=true
MetroSpawnIntervalMinutes=5
MaxMetroTrains=3
MinimumTrainGapMeters=100
TrainFollowingBraking=0.60
allowDriving=true
useMPH=true
showTrainBlips=true
ticketPrice=25
passengerTicketPrice=75
useMoney=false
MetroTicketMachineModels=prop_train_ticket_02,whit_bd_ticketbooth_01
PassengerTicketMachineModels=whit_bd_ticketbooth_02
allowDerail=true
autoDerail=true
riskChance=20
debug=false
Automatic service starts when the first player joins. Each enabled train type spawns up to its configured maximum, using its interval for additional trains. When the server becomes empty, automatic trains are removed and their schedules reset.
SETTINGS.INI REFERENCE
The defaults below are code fallbacks used when a setting is missing. The supplied settings.ini enables automatic service, driving, and derailment, sets MaxFreightTrains=1 and MetroSpawnIntervalMinutes=5, and includes passenger ticket-machine models. Review that file when installing; its values override these fallbacks. Set debug=false for normal operation.
Licensing and permissions
| Setting | Default | Description |
|---|---|---|
key1 |
None | Product key from your Big Daddy Scripts account. Place it under [licensing]. |
UseAcePermissions |
false |
When enabled, restricts train commands and all three editors to the configured ACE permission. |
AcePermission |
command |
ACE object checked when permissions are enabled. Use a specific value such as bigdaddy.trains. |
Automatic trains
| Setting | Default | Description |
|---|---|---|
AutoSpawnFreight |
false |
Enables automatic freight trains. |
FreightSpawnIntervalMinutes |
15 |
Minutes between freight spawns. Valid range: 0.1 to 1440. |
MaxFreightTrains |
2 |
Maximum automatic freight trains. Valid range: 0 to 32. |
AutoSpawnPassenger |
false |
Enables automatic passenger trains. |
PassengerSpawnIntervalMinutes |
20 |
Minutes between passenger spawns. Valid range: 0.1 to 1440. |
MaxPassengerTrains |
1 |
Maximum automatic passenger trains. Valid range: 0 to 32. |
AutoSpawnMetro |
false |
Enables automatic metro trains. |
MetroSpawnIntervalMinutes |
7 |
Minutes between metro spawns. Valid range: 0.1 to 1440. |
MaxMetroTrains |
3 |
Maximum automatic metro trains. Valid range: 0 to 32. |
MinimumTrainGapMeters |
100 |
Reserved distance between trains sharing a route. Valid range: 20 to 1000 meters. |
TrainFollowingBraking |
0.60 |
Braking rate used to maintain separation. Valid range: 0.05 to 5.0 m/s². |
The first train of every enabled type starts when a player is online. Additional trains are placed in the largest available gap on their route. When several consists exist for one type, the scheduler varies its selection and avoids immediately repeating the previous consist when possible.
The legacy spawnFreight, spawnMetro, freightFrequency, and metroFrequency keys are accepted only as fallbacks. New installations should use the settings above.
Driving, tickets, blips, and derailment
| Setting | Default | Description |
|---|---|---|
allowDriving |
false |
Allows players to use /trainspawn, enter the driver's position, and operate their train. Automatic and player-driven trains may run together. |
useMPH |
true |
Displays current and target driving speeds in MPH. Set to false for KM/H. Internal speed values remain in m/s. |
showTrainBlips |
true |
Enables nearby train and stop blips. |
ticketPrice |
25 |
Price of a one-use metro ticket. |
passengerTicketPrice |
75 |
Price of a one-use passenger ticket. |
useMoney |
false |
When false, valid ticket purchases are issued without charging money. When true, server.lua must confirm payment first. |
MetroTicketMachineModels |
prop_train_ticket_02,prop_train_ticket_02_tu,v_serv_tu_statio3_,prompt_sandy_train_ticketprop |
Comma-separated object models that sell metro tickets. The supplied file overrides this list. |
PassengerTicketMachineModels |
Empty | Comma-separated object models that sell passenger tickets. |
allowDerail |
false |
Enables /trainderail and the synchronized custom derailment system. |
autoDerail |
false |
Allows qualifying vehicle impacts to trigger a derailment. |
riskChance |
0 |
Percentage chance that an eligible automatic derailment occurs. Valid range: 0 to 100. |
debug |
false |
Enables additional diagnostic output. Leave disabled unless troubleshooting. |
DesyncKey is an internal protection value supplied with the resource. Preserve it when updating and do not copy a value from another product or installation.
Locale settings
The current resource reads user-facing text overrides from [locales] and uses built-in English text when a key is missing. Common ticket overrides in the supplied settings include:
| Setting | Purpose |
|---|---|
thankYouPurchase |
Successful metro-ticket purchase message |
thankYouPassengerPurchase |
Successful passenger-ticket purchase message |
noFunds |
Message shown when a payment cannot be completed |
The supplied [locales] section also includes transit branding, station notices, ticket failures, fare enforcement, boarding, driving, derailment, diagnostic, and editor messages. Preserve placeholders such as {ticketType}, {consistId}, and {routeId} when translating. Branding and fare-call keys include transitBrand, transitCallSource, and fareEvasionCall. Some HUD labels and editor control hints remain built into the client.
ACE PERMISSIONS
When UseAcePermissions=true, the server checks AcePermission before allowing train commands or editor actions. The permission is checked again when an editor saves changes.
Example settings.ini:
UseAcePermissions=true
AcePermission=bigdaddy.trains
Example server.cfg:
add_ace group.admin bigdaddy.trains allow
add_principal identifier.license:YOUR_LICENSE_IDENTIFIER group.admin
Console-issued diagnostic commands remain available to the server console. Player commands follow the configured ACE rule.
AUTOMATIC SERVICE
Freight and passenger trains use the statewide route supplied as freight-main. Metro trains use the city circuit supplied as metro-main. The server controls the complete logical fleet and keeps all clients synchronized, including players who join after a train has already started.
Trains automatically:
- Accelerate, brake, dwell, and depart according to the stop configuration
- Maintain separation from another train ahead on the same circuit
- Sound station and railroad-crossing horn patterns
- Stop ambient road traffic and operate supported crossing barriers
- Play type-specific idle, start, running, stopping, horn, and derailment audio
- Show nearby train and station blips when enabled
- Damage and push peds, vehicles, and suitable world objects that they strike
Automatic service and player driving are compatible. Trains do not physically collide with other rendered train copies, but the server's headway system slows or stops a following train before it reaches the train ahead.
After completing a full circuit, an automatic freight train can be replaced at its original spawn position with another configured freight consist. Replacement is skipped when a player is within 400 meters of that position and reconsidered after another circuit. Passenger and metro service do not use this freight replacement rule.
PLAYER COMMANDS
| Command | Description |
|---|---|
/trainspawn |
Lists the configured consist IDs. |
/trainspawn <consist-id> |
Spawns that consist on its normal route at the track point nearest the player. |
/trainspawn <consist-id> <route-id> |
Spawns the consist on an explicitly selected route. |
/trainremove |
Removes the train owned by the player. |
/trainderail |
Derails the train currently being driven. Available only when allowDerail=true. |
Each player may own one train at a time. A spawn is rejected if another train is too close to the nearest route position. Player-owned trains are removed when their owner disconnects or when the server becomes empty.
The supplied consist IDs may be changed in data/train_consists.xml. Run /trainspawn without arguments to see the IDs currently loaded by your installation.
DRIVING CONTROLS
The locomotive must be stopped before the owner can enter or exit its driving position.
| Control | Action |
|---|---|
F near the locomotive |
Enter the driver's position |
F while stopped |
Exit the driver's position |
| Up Arrow | Increase target speed by 1 m/s |
| Down Arrow | Decrease target speed by 1 m/s; negative speeds reverse the train |
E |
Hold to sound the train horn |
B |
Hold the service brake; release it to hold the newly reached speed |
| Spacebar | Apply the latched emergency brake |
Target speed is limited to -35 through 35 m/s. The service brake produces a normal stop without sparks or brake squeal. The emergency brake adds brake effects and remains active until the train reaches zero.
The driving HUD shows current speed, target speed, and service or brake status. useMPH changes its displayed units; arrow-key adjustments still change the target by 1 m/s.
PASSENGERS, STOPS, AND TICKETS
Passengers can board only while a train is in its stopped/dwelling state. Automatic trains enter this state at configured stops; player-driven trains can enter it when stopped with a zero target speed, including away from a configured station. Walk to a configured passenger position and use F BOARD TRAIN. While the train is stopped again, use F EXIT TRAIN to leave. The server reserves passenger positions so two players cannot occupy the same spot.
Passenger positions are model-specific. If a car has no positions in data/train_passenger_config.xml, it cannot be used for boarding until positions are added with the passenger editor.
Ticket machines support two interaction methods:
ox_targetorqb-target, when either is running- The built-in
Eproximity interaction when no supported target system is running
A player may hold one valid ticket of each type. A metro ticket is consumed after successful metro boarding. Metro passengers without a valid metro ticket are still allowed to board, but one fare-evasion event is sent through server.911.lua. Passenger tickets can be sold, but are currently neither checked nor consumed during passenger-train boarding. Ticket state is cleared on disconnect or resource restart.
Money setup
Leave useMoney=false to issue tickets without charging an account. To charge players:
- Set
useMoney=trueinsettings.ini. - Open
server.lua. - Set
frameworktonat,qb,esx,nd,bigdaddy, orcustom. - Configure any optional society-account values.
- For
custom, replace the placeholder purchase branch with your server-authoritative balance check and debit. Return success only after money has actually been removed.
The C# ticket manager validates the ticket type and price before requesting payment. A ticket is issued only after server.lua reports a successful debit.
Fare-evasion calls
Configure cad in server.911.lua as none, sonoran, imperial, snaily, or your custom provider. With none, BigDaddy-LocalsCall911 can receive the existing event when installed. Provider-specific API details must also be completed in that file.
CONFIGURATION FILES
The new version does not use train indexes. Routes, consists, stops, and boarding use four XML files; station scenery uses a separate JSON file:
| File | Purpose |
|---|---|
data/train_routes.xml |
Closed route geometry, route IDs, default train types, and route speeds |
data/train_consists.xml |
Named freight, passenger, and metro consists plus car placement and liveries |
data/train_stops.xml |
Route nodes used as stops plus dwell, acceleration, braking, names, and announcement keys |
data/train_passenger_config.xml |
Boarding distance, exit offset, passenger positions, and animation presets |
data/trainstations.json |
Ambient station peds and props, including their models, placement, and actions |
Manual XML edits require a resource restart. Saves made through the consist, stop, and passenger editors refresh the live configuration immediately. Active trains using an edited consist receive a new definition and rebuild from the saved spacing, height, and livery values.
BACK UP XML FILES BEFORE EDITING
Invalid XML, an unknown route or model, duplicate defaults, and out-of-range nodes can prevent the train system from initializing. Keep each XML element's opening tag and attributes on a single line, with double-quoted attribute values. This includes
<TrainStops>and each<Vehicle>or<Stop>entry because the loader reads one line at a time.
{:is-warning}
Routes
Each <Route> in train_routes.xml has a stable ID, default train type, speed, and ordered collection of 3D rail nodes. Routes must be closed circuits. The supplied configuration provides freight-main and metro-main.
Large route node lists are read locally by the server and every client rather than sent across network events. All players must therefore run the same resource files.
Consists
Every train type must have exactly one default consist. A vehicle entry supports:
| Attribute | Description |
|---|---|
model |
Vehicle model name |
livery |
Requested livery index |
offset |
Gap in meters behind the preceding car; use 0 for the locomotive |
zOffset |
Per-car vertical adjustment after automatic rail-height placement |
headingOffset |
Per-car rotation relative to the route direction |
repeat |
Optional number of repeated copies of that vehicle entry |
railHeightOffset on the consist sets the base wheel-to-rail placement correction. Use the in-game consist editor for spacing, height, and livery adjustments whenever possible.
Stops
A stop matches only the configured route and trainType. Global defaults belong on the <TrainStops> element:
<TrainStops version="1" defaultDwellSeconds="20.0" defaultDwellSecondsMetro="20.0" defaultDwellSecondsFreight="120.0" defaultDwellSecondsPassenger="45.0" defaultAcceleration="0.60" defaultBraking="0.60">
An individual <Stop> may override dwellSeconds, acceleration, or braking. Metro stops may also provide a display name and an announcement key. For custom announcements, add a lowercase OGG file with the matching key to html/sounds and ensure it remains covered by the manifest's sound-file entry.
Passenger positions
Passenger spots are local to a car model:
x,y, andzposition the passenger inside the modelheadingrotates the passenger relative to the cartypeisstandingorsittinganimDictandanimmust either both be valid or both be blank
Use the passenger-position editor instead of hand-measuring these values.
Station scenery
data/trainstations.json is an array of station ped and prop definitions, separate from the operational stops in train_stops.xml. Preserve the supplied entry structure when editing model hashes, positions, rotations, and ped actions. Supported actions include Drink Coffee, Smoke, and Walk; Walk, Any - Walk, and Any - Warp make peds wander around their saved position.
Each client creates its own non-networked station entities after licensing succeeds and removes them on desync or resource shutdown. Restart the resource after editing this file. Missing or invalid station JSON disables station scenery and produces an F8 message.
IN-GAME EDITORS
All editor commands use the same ACE permission as the train commands when permissions are enabled. Editors write directly to the resource's XML files, so the server process must have permission to write inside the resource directory.
Consist editor
Use:
/trainconsistedit <consist-id> [route-id]
The selected consist is placed on the nearest point of the appropriate route. Walk near a car to select it.
| Control | Action |
|---|---|
| Left/Right Arrow | Decrease/increase the selected car's coupling gap by 0.05 m |
| Up/Down Arrow | Raise/lower its zOffset by 0.05 m |
| Page Up/Page Down | Cycle available liveries |
| Enter | Validate and save the complete consist |
| Escape | Close without saving |
Models and headings cannot be changed through this editor. A consist that used repeat is expanded into individual vehicle lines when saved so every edited car retains its own values.
Stop editor
Use:
/trainstopedit <freight|metro|passenger>
The editor selects the route nearest the player and displays nearby route nodes. The closest node is orange; existing stops for the selected train type are green.
| Control | Action |
|---|---|
| Enter | Add the closest node as a stop |
| Delete | Remove the selected train type's stop from that node |
| Escape | Close the editor |
The editor remains open after a successful change so several stops can be configured in one session. Newly added stops receive stable generated IDs.
Passenger-position editor
Use:
/trainpassengeredit <train-car-model>
The model must already be used by a configured consist. Walk inside the preview car and press Enter to add a standing position. Move within three meters of an existing marker to select it.
| Control | Action |
|---|---|
| Enter | Add a position at the player's current location |
| Left/Right Arrow | Change local X by 0.05 m |
| Up/Down Arrow | Change local Y by 0.05 m |
| Page Up/Page Down | Change local Z by 0.05 m |
| Shift + Left/Right Arrow | Rotate heading by 2.5 degrees |
| Tab | Switch between standing and sitting |
Q / E |
Cycle compatible animation presets |
| Spacebar | Preview or stop previewing the selected position and animation |
C |
Toggle the aisle camera |
| Mouse Wheel | Move the aisle camera forward or backward |
X |
Reverse the aisle camera direction |
| Delete | Remove the selected position |
F5 |
Save all positions for the model |
| Escape | Cancel and close |
DIAGNOSTIC COMMANDS
/traintest is an administrative and troubleshooting command, not the normal player spawning command.
| Command | Description |
|---|---|
/traintest routes |
Lists loaded route IDs. |
/traintest consists |
Lists loaded consist IDs and types. |
/traintest status |
Reports the manual test train and automatic fleet count. |
/traintest sync |
Resends the complete active fleet to the requesting client. |
/traintest inspect |
Writes local train and car details to the player's F8 console. |
/traintest start [route-id] [type-or-consist] [speed] [distance] |
Starts or changes the single manual test train. |
/traintest restart [route-id] [speed] |
Recreates the manual train from route distance zero. |
/traintest derail [train-id] |
Derails the manual or named active train. |
/traintest cleanup [train-id] |
Removes a derailed train. |
/traintest stop |
Removes the manual test train without disabling automatic service. |
Useful examples:
/traintest start
/traintest start metro-main 8 0
/traintest start freight-main passenger 12 0
/traintest start freight-main passenger-long 12 0
IMPORTANT BEHAVIOR
Client-local trains
The physical train cars are local, non-networked vehicles synchronized from server-owned logical state. This is intentional. Do not replace them with CreateMissionTrain, attempt to network the client copies, or add the old trains.xml/train-index system.
Late joiners receive the active fleet at its current route distance. Distance-based processing reduces the rendering cost of faraway trains without pausing the server simulation.
Visible doors
The included vehicle models expose train-door metadata, but their doors do not respond to normal vehicle-door natives when each car is created as a local vehicle. Stops, dwell state, boarding, exit placement, prompts, and tickets still operate. Visible animated doors require vehicle assets authored for a non-mission-train control path.
Crossing behavior
Automatic barrier control supports the supplied GTA crossing-arm models and compatible custom-map placements. The traffic stop affects ambient AI vehicles only; it does not take control away from player-driven vehicles.
Derailments
Derailments remain synchronized even though train cars are local. The server records the derailment state and every client reconstructs the same articulated slide, effects, and cleanup. Cars that lose rail or ground support can separate and fall under local physics.
TROUBLESHOOTING
The resource does not start
- Confirm the folder is named exactly
BigDaddy-Trains. - Confirm the product key is present under
[licensing]. - Check the server console for licensing, XML, missing-file, or configuration errors.
- Make sure the complete release was installed, not only updated DLL files.
- Confirm
settings.ini, all four XML files,data/trainstations.json, NUI assets, and streamed files are declared and present.
Automatic trains do not appear
- Confirm the appropriate
AutoSpawn...setting istrueand its maximum is greater than zero. - At least one player must be connected.
- Check
/traintest status,/traintest routes, and/traintest consists. - Check the server console for invalid XML, a missing default consist, or an unknown route.
A player cannot spawn or edit trains
- Confirm
allowDriving=truefor player-owned trains. - If ACE permissions are enabled, verify the player has the exact configured
AcePermission. - A player must remove an existing owned train before spawning another.
- Move closer to the intended route and away from another active train.
A ticket is not issued
- With
useMoney=true, verify the selected framework inserver.luais running and its payment branch can debit the player. - A
customframework returns failure until its placeholder code is implemented. - Confirm the machine model appears in the correct comma-separated setting.
- Check both the server console and the player's F8 console for payment or interaction errors.
Players cannot board
- The train must be in its stopped/dwelling state. Automatic trains need a stop configured for their route and type; player-driven trains must be stopped with a zero target speed.
- The car model must have passenger spots in
data/train_passenger_config.xml. - The player must be within the configured
boardingDistanceof an available spot. - Use
/trainpassengeredit <model>to inspect or add positions.
Blips or custom audio are missing
- Confirm
showTrainBlips=truefor blips. - Install the complete
stream,audiodirectory,html, anddatafolders. - Clear stale client cache after replacing streamed texture or audio assets.
- Custom station announcement keys must match lowercase OGG filenames in
html/sounds.
When requesting support, include the relevant server-console output, the player's F8 log, your non-secret settings, and the exact command or train type involved.