<?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=Dreft</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=Dreft"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Dreft"/>
	<updated>2026-04-27T21:09:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleColor&amp;diff=21576</id>
		<title>SetVehicleColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleColor&amp;diff=21576"/>
		<updated>2009-09-22T17:45:51Z</updated>

		<summary type="html">&lt;p&gt;Dreft: /* Second example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function will set the color of a vehicle. Each vehicle can have up to 4 colors, for different aspects of the vehicle. Most vehicles only use two of the colors.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server and Client&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setVehicleColor ( vehicle theVehicle, int color1, int color2, int color3, int color4 )            &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] that you wish to set the color of.&lt;br /&gt;
*'''color1:''' An integer indicating the first (main) color for the vehicle&lt;br /&gt;
*'''color2:''' An integer indicating the second color for the vehicle&lt;br /&gt;
*'''color3:''' An integer indicating the third color for the vehicle&lt;br /&gt;
*'''color4:''' An integer indicating the fourth color for the vehicle&lt;br /&gt;
&lt;br /&gt;
The table below shows valid color ids:&lt;br /&gt;
{{Vehicle_colors}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if vehicle's color was set, ''false'' if an invalid vehicle or invalid color ids were specified.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 1&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example implements a serverside ''set_vehicle_color'' console command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Define our function that will handle the command&lt;br /&gt;
function consoleSetVehicleColor ( playerSource, commandName, col1, col2, col3, col4 )&lt;br /&gt;
	-- If a player triggered this in-game&lt;br /&gt;
	if ( playerSource ) then&lt;br /&gt;
		-- Get the player's vehicle&lt;br /&gt;
		playerVehicle = getPlayerOccupiedVehicle ( playerSource )&lt;br /&gt;
		-- If the player is in a vehicle and we've got at least 1 parameter&lt;br /&gt;
		if ( playerVehicle and col1 ) then&lt;br /&gt;
			-- Get the vehicle's existing color and use it if fewer than 4 arguments were passed&lt;br /&gt;
			exCol1, exCol2, exCol3, exCol4 = getVehicleColor ( playerVehicle )&lt;br /&gt;
&lt;br /&gt;
			if not col2 then col2 = exCol2 end&lt;br /&gt;
			if not col3 then col3 = exCol3 end&lt;br /&gt;
			if not col4 then col4 = exCol4 end&lt;br /&gt;
&lt;br /&gt;
			-- Set the vehicle's color&lt;br /&gt;
			setVehicleColor ( playerVehicle, col1, col2, col3, col4 )&lt;br /&gt;
		else&lt;br /&gt;
			-- If we didn't get at least 1 parameter or the player doesn't have a vehicle, display some help text&lt;br /&gt;
			outputConsole ( &amp;quot;This function will set your current vehicle's colors. A vehicle can have up to 4 colors.&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;Syntax: set_vehicle_color color1 [ color2 color3 color4 ]&amp;quot;, playerSource )&lt;br /&gt;
			outputConsole ( &amp;quot;You must be in a vehicle to use this function.&amp;quot;, playerSource )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Register the command handler and attach it to the consoleSetVehicleColor function&lt;br /&gt;
addCommandHandler ( &amp;quot;set_vehicle_color&amp;quot;, consoleSetVehicleColor )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example changes all vehicles color to random every 0.5 sec.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function randomVehColors()&lt;br /&gt;
	for i, car in ipairs( getElementsByType( &amp;quot;vehicle&amp;quot; ) ) do&lt;br /&gt;
		local color = {}&lt;br /&gt;
		color[1] = math.random(0,126) -- random from 0 to 126, because colors is from 0 to 126&lt;br /&gt;
		color[2] = math.random(0,126)&lt;br /&gt;
		color[3] = math.random(0,126)&lt;br /&gt;
		color[4] = math.random(0,126) -- we take 4 random numbers because setVehicleColor have parameters with 4 colors&lt;br /&gt;
		setVehicleColor ( car, color[1], color[2], color[3], color[4] ) -- setting color to vehicle&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
setTimer( randomVehColors, 500, 0 )	-- timer changes all vehicles colors to random every 0.5 sec.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&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>Dreft</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetVehicleDoorsUndamageable&amp;diff=21575</id>
		<title>SetVehicleDoorsUndamageable</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetVehicleDoorsUndamageable&amp;diff=21575"/>
		<updated>2009-09-22T17:35:50Z</updated>

		<summary type="html">&lt;p&gt;Dreft: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function makes a vehicle's doors undamageable, so they won't fall off when they're hit. Note that the vehicle '''has''' to be locked using [[setVehicleLocked]] for this setting to have any effect.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server and Client&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theVehicle:''' The [[vehicle]] of which you wish to set the car door damageability.&lt;br /&gt;
*'''state:''' A boolean denoting whether the vehicle's doors are undamageable (''true'') or damageable (''false'').&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the damageability state was successfully changed, ''false'' if invalid arguments were passed.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Here you can disable all vehicles doors damage with /nodamage, and enable it with /adddamage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function doorsLikeGod()&lt;br /&gt;
	for i, car in ipairs( getElementsByType (&amp;quot;vehicle&amp;quot;) ) do&lt;br /&gt;
		setVehicleDoorsUndamageable ( car, true )&lt;br /&gt;
	end&lt;br /&gt;
	outputChatBox(&amp;quot;All vehicles doors is not damageable&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;nodamage&amp;quot;, doorsLikeGod)&lt;br /&gt;
&lt;br /&gt;
function doorsNotLikeGod()&lt;br /&gt;
	for i, car in ipairs( getElementsByType (&amp;quot;vehicle&amp;quot;) ) do&lt;br /&gt;
		setVehicleDoorsUndamageable ( car, false )&lt;br /&gt;
	end&lt;br /&gt;
	outputChatBox(&amp;quot;Now everyone can kick vehicles doors and throw them away.&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;adddamage&amp;quot;, doorsNotLikeGod)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;br /&gt;
[[Category:Needs Example]]&lt;/div&gt;</summary>
		<author><name>Dreft</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetVehicleType&amp;diff=21574</id>
		<title>GetVehicleType</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetVehicleType&amp;diff=21574"/>
		<updated>2009-09-22T17:27:53Z</updated>

		<summary type="html">&lt;p&gt;Dreft: /* Second example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{New feature|3|1.0|&lt;br /&gt;
This function retrieves the type of a vehicle (such as if it is a car or a boat).&lt;br /&gt;
}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getVehicleType ( vehicle theVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
'''OR'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
string getVehicleType ( int modelId )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''vehicle:''' The vehicle element to get the type of.&lt;br /&gt;
*'''modelId:''' A vehicle model id&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''string'' with vehicle type or ''false'' if an invalid modelID has been supplied, or an empty string if the vehicle is blocked internally (some trailers).&lt;br /&gt;
&lt;br /&gt;
Possible strings returned:&lt;br /&gt;
* '''Automobile''': Cars, vans and trucks&lt;br /&gt;
* '''Plane'''&lt;br /&gt;
* '''Bike''': Motorbikes&lt;br /&gt;
* '''Helicopter'''&lt;br /&gt;
* '''Boat'''&lt;br /&gt;
* '''Train'''&lt;br /&gt;
* '''Trailer''': A trailer for a truck&lt;br /&gt;
* '''BMX'''&lt;br /&gt;
* '''Monster Truck'''&lt;br /&gt;
* '''Quad''': Quadbikes&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
In this example when a player enters an airplane, it displays a message welcoming the player onboard.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function enterPlane(theVehicle, seat, jacked)&lt;br /&gt;
    if (getVehicleType(theVehicle) == &amp;quot;Plane&amp;quot;) then&lt;br /&gt;
        outputChatBox(&amp;quot;Welcome onboard!&amp;quot;, source)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), enterPlane)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this another example player gets message what type of vehicle he just entered.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function enteredVehicleType(theVehicle, seat, jacked)&lt;br /&gt;
	outputChatBox(&amp;quot;You entered &amp;quot;.. getVehicleType(theVehicle) ..&amp;quot;.&amp;quot;, source)&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), enteredVehicleType)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Vehicle functions}}&lt;/div&gt;</summary>
		<author><name>Dreft</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User:Dreft&amp;diff=21345</id>
		<title>User:Dreft</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User:Dreft&amp;diff=21345"/>
		<updated>2009-08-28T08:57:57Z</updated>

		<summary type="html">&lt;p&gt;Dreft: Created page with 'w00t :o  Everything is just creation...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;w00t :o&lt;br /&gt;
&lt;br /&gt;
Everything is just creation...&lt;/div&gt;</summary>
		<author><name>Dreft</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=User_talk:Dreft&amp;diff=21344</id>
		<title>User talk:Dreft</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=User_talk:Dreft&amp;diff=21344"/>
		<updated>2009-08-28T08:57:31Z</updated>

		<summary type="html">&lt;p&gt;Dreft: Created page with 'w00t :o  Everything is just creation...'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;w00t :o&lt;br /&gt;
&lt;br /&gt;
Everything is just creation...&lt;/div&gt;</summary>
		<author><name>Dreft</name></author>
	</entry>
</feed>