Squirrel/Client/Events/Vehicle/onTrainArrive
From Liberty Unleashed Wiki
(Difference between revisions)
m |
m (Forgot the LU only bar) |
||
Line 1: | Line 1: | ||
{{Squirrel/Title|onTrainArrive}} | {{Squirrel/Title|onTrainArrive}} | ||
+ | {{Squirrel/LUOnly}} | ||
{{ScriptingChangesIn0.1.0.11}} | {{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. |
Latest revision as of 23:53, 12 September 2011
This is called when a train arrives at a train station.
[edit] Syntax
function onTrainArrive( int train, int station )
[edit] Arguments
- train - The ID of the train in question
- station - The station the train arrived at. See a list of constants here.
[edit] Returns
This event does not handle return values.
[edit] 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"; }
[edit] Notes
The functions Message, FindLocalPlayer and Player.Train were used in this example. More info about them can be found in the corresponding pages.