Squirrel/Client/Events/Vehicle/onTrainLeave
From Liberty Unleashed Wiki
(Difference between revisions)
(Created page with '{{Squirrel/Title|onTrainLeave}} {{ScriptingChangesIn0.1.0.11}} This is called when a train departs from a train station. == Syntax == <code>function onTrainLeave( int train, in…') |
m (Forgot the LU only bar) |
||
Line 1: | Line 1: | ||
{{Squirrel/Title|onTrainLeave}} | {{Squirrel/Title|onTrainLeave}} | ||
+ | {{Squirrel/LUOnly}} | ||
{{ScriptingChangesIn0.1.0.11}} | {{ScriptingChangesIn0.1.0.11}} | ||
This is called when a train departs from a train station. | This is called when a train departs from a train station. |
Latest revision as of 23:54, 12 September 2011
This is called when a train departs from a train station.
[edit] Syntax
function onTrainLeave( int train, int station )
[edit] Arguments
- train - The ID of the train in question
- station - The station the train left from. 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 leaves from a station.
function onTrainLeave( train, station ) { if ( train == FindLocalPlayer().Train ) { Message( "You departed from " + 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.