Squirrel/Client/Events/Vehicle/onTrainArrive

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events
LU This function works in Liberty Unleashed only.

This is called when a train arrives at a train station.

[edit] Syntax

  1. 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.

  1.  
  2. function onTrainArrive( train, station )
  3. {
  4. if ( train == FindLocalPlayer().Train )
  5. {
  6. Message( "You arrived at " + GetTrainStationName( station ) + " Station" );
  7. }
  8. return 1;
  9. }
  10.  
  11. function GetTrainStationName( station )
  12. {
  13. switch ( station )
  14. {
  15. // L-train
  16. case STATION_STMARKS:
  17. return "Baillie";
  18. case STATION_HEPBURN:
  19. return "Rothwell";
  20. case STATION_CHINATOWN:
  21. return "Kurowski";
  22.  
  23. // Subway
  24. case STATION_PORTLAND:
  25. return "Portland";
  26. case STATION_ROCKFORD:
  27. return "Rockford";
  28. case STATION_TERMINAL:
  29. return "Shoreside Terminal";
  30. case STATION_STAUNTON:
  31. return "Staunton South";
  32. }
  33.  
  34. return "Train";
  35. }
  36.  

[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.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox