Train spawn
#1

How spawn train?
Reply
#2

Get the coords of a railway point, then put them into the CreateVehicle or AddStaticVehicle function with the train's model.

Nonameman
Reply
#3

Train can be spawned only on railway.so just get the XYZ of the railway
Reply
#4

And as written in the wiki,trains can only be created with AddStaticVehicle and not CreateVehicle.
Reply
#5

Alright but how do you spawn passenger coaches? Like that's the engine, how do you spawn the coaches behind? or how you make them like connect each other?
Reply
#6

If I remember correctly it just spawns the train as a whole. So the engine and two or three carriages at once.
Reply
#7

The passenger cars will spawn when you spawn the train. @Vince, you are correct.
Reply
#8

Here ya go, this spawns a train in all train stations:

pawn Code:
AddStaticVehicleEx(537,1695.2631,-1953.6426,14.8756,89.9202,1,1, 120);
AddStaticVehicleEx(537, 1466.8977, 2632.2500,12.1256,270.0000,1,1, 120);
AddStaticVehicleEx(537, 2864.7500, 1254.7863,12.1256,180.0000,1,1, 120);
AddStaticVehicleEx(537,-1942.9858,  165.1703,27.0006,356.8288,1,1, 120);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)