Squirrel/Client/Events/Vehicle/onTrainArrive
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|onTrainArrive}} This is called when a train arrives at a train station. == Syntax == <code>function onTrainArrive( int train, int station )</code> === Argumen…') |
m |
||
Line 1: | Line 1: | ||
{{Squirrel/Title|onTrainArrive}} | {{Squirrel/Title|onTrainArrive}} | ||
+ | {{ScriptingChangesIn0.1.0.11}} | ||
This is called when a train arrives at a train station. | This is called when a train arrives at a train station. | ||
Revision as of 23:46, 12 September 2011
This is called when a train arrives at a train station.
Syntax
function onTrainArrive( int train, int station )
Arguments
- train - The ID of the train in question
- station - The station the train arrived at. See a list of constants here.
Returns
This event does not handle return values.
Example
This example will message the player when their train arrives at a station.
function onTrainArrive( train, station ) { if ( train == FindLocalPlayer().Train ) { Message( "You arrived at " + GetTrainStationName( station ) + " Station" ); } return 1; } function GetTrainStationName( station ) { switch ( station ) { // L-train case STATION_STMARKS: return "Baillie"; case STATION_HEPBURN: return "Rothwell"; case STATION_CHINATOWN: return "Kurowski"; // Subway case STATION_PORTLAND: return "Portland"; case STATION_ROCKFORD: return "Rockford"; case STATION_TERMINAL: return "Shoreside Terminal"; case STATION_STAUNTON: return "Staunton South"; } return "Train"; }
Notes
The functions Message, FindLocalPlayer and Player.Train were used in this example. More info about them can be found in the corresponding pages.