If you are having an issue where you crash after loading into the game with errors pointing to the trains, go to the settings and set:
disableAutoIndexing=true
Now you will have to manually index your trains.
Load into the server.
Enter command /train 0
This should either spawn a train or tell you it doesn't exist at that index.
Depending on what type of train spawns, note the type and index.
Do this counting up until you get through them all, or they start repeating (sometimes they do) and enter the indexes into the settings.ini that you found.
EXAMPLE (you will need to put your indexes in similar to this - for a range use start,end)
metroTrainIndex=15
freightTrainIndexes=2,14
passengerTrainIndexes=0,1
Restart the server and it should now know what indexes your trains are.