<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=NeQu</id>
	<title>Multi Theft Auto: Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=NeQu"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/NeQu"/>
	<updated>2026-05-07T12:29:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetTrainTrack&amp;diff=53995</id>
		<title>SetTrainTrack</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetTrainTrack&amp;diff=53995"/>
		<updated>2018-02-20T15:28:58Z</updated>

		<summary type="html">&lt;p&gt;NeQu: missing player element in outputchatbox&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Shared function}}&lt;br /&gt;
{{New feature/item|3.0160|1.6|7485|&lt;br /&gt;
Sets the track of a train&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setTrainTrack ( vehicle train, int track )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[vehicle]]:setTrack|track|getTrainTrack}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''train:''' the train of which to set the track&lt;br /&gt;
*'''track:''' the track where you want to set the train. It can be 0, 1, 2 or 3.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the track was set to the train, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This server-side script allows the player to change the track of their train.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Procedural&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;trackies&amp;quot;,&lt;br /&gt;
	function (player, _, track)&lt;br /&gt;
		local theVehicle = getPedOccupiedVehicle(player)&lt;br /&gt;
		if not theVehicle then&lt;br /&gt;
			outputChatBox(&amp;quot;You are not in a vehicle!&amp;quot;, player)&lt;br /&gt;
			return&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if getVehicleType(theVehicle) == &amp;quot;Train&amp;quot; then&lt;br /&gt;
			setTrainTrack(theVehicle, track)&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox(&amp;quot;You are not in a train!&amp;quot;, player)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Object Oriented&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler(&amp;quot;trackies&amp;quot;,&lt;br /&gt;
	function (player, _, track)&lt;br /&gt;
		local veh = player.vehicle&lt;br /&gt;
		if not veh then&lt;br /&gt;
			return outputChatBox(&amp;quot;You are not in a vehicle!&amp;quot;, player)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if veh.vehicleType == &amp;quot;Train&amp;quot; then&lt;br /&gt;
			veh.track = track&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox(&amp;quot;You are not in a train!&amp;quot;, player)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>NeQu</name></author>
	</entry>
</feed>