<?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=VenadHD</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=VenadHD"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/VenadHD"/>
	<updated>2026-05-01T06:13:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46457</id>
		<title>RefreshResource</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46457"/>
		<updated>2016-01-23T14:23:52Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This code refreshes your resource if any part of the code or some resource file has changed, it works just like &amp;quot;refreshResources ()&amp;quot; but adapted for one particular resource&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;refreshResource()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Return==&lt;br /&gt;
Returns '''false''' if none has changed&lt;br /&gt;
==code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local Bytes = 0&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
	function()&lt;br /&gt;
	local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
		if meta then&lt;br /&gt;
			for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
				if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
				local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
				local _ = fileGetSize(file)&lt;br /&gt;
				Bytes = Bytes + _&lt;br /&gt;
				fileClose(file)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
--USEFUL FUNCTION&lt;br /&gt;
function refreshResource ()&lt;br /&gt;
local newBytes = 0&lt;br /&gt;
local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
	if meta then&lt;br /&gt;
		for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
			if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
			local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
			local _ = fileGetSize(file)&lt;br /&gt;
			newBytes = newBytes + _&lt;br /&gt;
			fileClose(file)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if newBytes ~= Bytes then&lt;br /&gt;
		print(getResourceName(getThisResource())..&amp;quot; has changed.. reloading...&amp;quot;)&lt;br /&gt;
		restartResource(getThisResource())&lt;br /&gt;
		else&lt;br /&gt;
		return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
TODO.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TODO&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=46297</id>
		<title>Template:Useful Functions</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Template:Useful_Functions&amp;diff=46297"/>
		<updated>2016-01-04T23:01:57Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;*[[attachEffect]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you attach an effect to an element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[bindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to bind each key bound to a control individually. Doing this bypasses a little MTA restriction.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callClientFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any client-side function from the server's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[callServerFunction]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to call any server-side function from the client's side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[capitalize]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function capitalizes a given string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[centerWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function centers a CEGUI window element responsively in any resolution.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[Check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if its arguments are of the right type and calls the error-function if one is not.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts and formats large numbers.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertServerTickToTimeStamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts server ticks to a unix timestamp.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[convertTextToSpeech]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts the provided text to a speech in the provided language which players can hear.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[coroutine.resume]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function applies a fix for hidden coroutine error messages.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawAnimWindow]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws an animated 2D window on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawCircle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a number of 2D lines in order to achieve a circle shape on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawEmptyRectangle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws an empty 2D rectangle on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawGifImage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function simulates the effect of a GIF image by using image sprites in 2D.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawImage3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D image in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawLoading]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a loading bar on the screen.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxDrawRectangle3D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function draws a 3D rectangle in GTA world.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetFontSizeFromHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the font size from given height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[dxGetRealFontHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the height of a font.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[findRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function takes two points and returns the direction from point A to point B.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[FormatDate]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function formats a date on the basis of a format string and returns it.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function generates a random string with any characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[generateRandomASCIIString]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a random string which uses ASCII characters. &amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function calculates the age of a given birthday.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayers (Client)|getAlivePlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getAlivePlayersInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the alive players in a team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBanFromName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This functions returns the ban of the given playername.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getBoundControls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of control names that are bound to the specified key.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCurrentFPS]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the frames per second at which GTA: SA is running.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getCursorMoveOn]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks in which way the cursor is currently moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getDistanceBetweenPointAndSegment2D]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function takes point coordinates and line (a segment) starting and ending coordinates. It returns the shortest distance between the point and the line.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the specified element's speed in m/s, km/h or mph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsInDimension]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are in the specified dimension.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getElementsWithinMarker]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of elements that are within a marker's collision shape.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getJetpackWeaponsEnabled]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of enabled weapons usable on a jetpack.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getKeyFromValueInTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the key of the specified value in a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOffsetFromXYZ]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to take an entity and a position and calculate the relative offset between them accounting for rotations.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineAdmins]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all logged-in administrators.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getOnlineStaff]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string of all logged-in administrators separated by two whitespace characters.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxHealth]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a pedestrians's maximum health by converting it from their maximum health stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPedMaxOxygenLevel]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a ped's maximum oxygen level by converting it from their maximum underwater stamina stat.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromNamePart]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from partial name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerFromSerial]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a player from their serial.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayerAcls]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all ACL groups on a player.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersByData]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of players that have the specified data name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPlayersInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all players in photograph.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getPointFromDistanceRotation]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function finds a point based on a starting point, direction and distance.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceSettings]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource settings.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getResourceScripts]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of the resource scripts.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getRGColorFromPercentage]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia', sans-serif; font-size:smaller;&amp;quot;&amp;gt;»This function returns two integers representing red and green colors according to the specified percentage.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getScreenRotationFromWorldPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a screen relative rotation to a world position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTeamFromColor]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element by the specified color.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTeamWithFewestPlayers]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a team element with least players of all the specified teams.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getTimestamp]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the UNIX timestamp of a specified date and time.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getValidVehicleModels]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a table of all valid vehicle models.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getVehicleRespawnPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to get the respawn position of a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getXMLNodes]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns all children of a XML node.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[getGridListRowIndexFromText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the GridList row index from the specified text.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiComboBoxAdjustHeight]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function adjusts a CEGUI combobox element to have the correct height.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[guiGridListGetSelectedText]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string containing the inner text of a selected gridlist item.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[IfElse]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns one of two values based on a boolean expression.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isCursorOnElement]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether the cursor is in a particular area.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInPhotograph]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is in the player's camera picture area.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementInRange]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check if an element's range to a main point is within the maximum range.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementMoving]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is moving.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isElementWithinAColShape]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if an element is within a collision shape element.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isLeapYear]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a boolean representing if a given year is a leap year.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isMouseInPosition]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to check whether the mouse cursor/pointer is within a rectangular position.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAiming]]&amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a pedestrian is aiming their weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedDrivingVehicle]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified pedestrian is driving a vehicle.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInACL]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player element is in an ACL group.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPlayerInTeam]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a player is in a specified team.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isSoundFinished]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a sound element has finished.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleEmpty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a vehicle is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOccupied]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if a specified vehicle is occupied.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isVehicleOnRoof]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether vehicle is on roof.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isPedAimingNearPed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This is similar to isPedAiming but uses a colshape to be more precise.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[isTextInGridList]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks if some text exist or not in the GridList.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[iterElements]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns ''a time-saving'' iterator for your for-loops.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[mathNumber]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is a workaround for the client-side floating-point precision of 24-bits.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.percent]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a percentage from two number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[math.round]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» Rounds a number whereas the number of decimals to keep and the method may be set.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[multi_check]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks one element to many, handy and clean.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[onVehicleWeaponFire]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This code implements an event that is triggered when a player in a vehicle fires a vehicle's weapon.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[rangeToTable]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a string range to a table containing number values.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[refreshResource]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function refreshes your resource if you changed any of the files&lt;br /&gt;
*[[renameAclGroup]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function gives an existing ACL group a new name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[RGBToHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns a string representing the color in hexadecimal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[secondsToTimeDesc]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a plain seconds-integer into a user-friendly time description.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setAccountName]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function is used to change an existing account's name.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setElementSpeed]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to set the speed of an element in kph or mph units.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setTableProtected]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function protects a table and makes it read-only.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[setVehicleGravityPoint]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function sets a vehicle's gravity in the direction of a 3 dimensional coordinate with the strength specified.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[smoothMoveCamera]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to create a cinematic camera flight.&lt;br /&gt;
*[[string.count]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function counts the amount of occurences of a string in a string.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[string.explode]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function splits a string at a given separator pattern and returns a table with the pieces.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[switch]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows the value of a variable or expression to control the flow of program execution via a multiway branch.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.copy]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function copies a whole table and all the tables in that table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.compare]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether two given tables are equal.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.empty]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function checks whether a table is empty.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.map]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function goes through a table and replaces every field with the return of the passed function, where the field's value is passed as first argument and optionally more arguments.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.merge]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function merges two or more tables together.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.random]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function retrieves a random value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.size]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function returns the absolute size of a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[table.removeValue]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function removes a specified value from a table.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[toHex]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a decimal number to a hexadecimal number, as a fix to be used client-side.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[unbindControlKeys]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function allows you to unbind each key bound to a control individually. Use this function with [[bindControlKeys]].&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[var dump]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function outputs information about one or more variables using outputConsole.&amp;lt;/span&amp;gt;&lt;br /&gt;
*[[wavelengthToRGBA]] &amp;lt;span style=&amp;quot;color:gray; font-family:'Georgia',sans-serif; font-size:smaller;&amp;quot;&amp;gt;» This function converts a physical wavelength of light to a RGBA color.&amp;lt;/span&amp;gt;&lt;br /&gt;
[[Category:Useful Functions]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46296</id>
		<title>RefreshResource</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46296"/>
		<updated>2016-01-04T22:54:36Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This code refreshes your resource if any part of the code or some resource file has changed, it works just like &amp;quot;refreshResources ()&amp;quot; but adapted for one particular resource&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;refreshResource()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Return==&lt;br /&gt;
Returns '''false''' if none has changed&lt;br /&gt;
==code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local files = {}&lt;br /&gt;
local Bytes = 0&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
	function()&lt;br /&gt;
	local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
		if meta then&lt;br /&gt;
			for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
				if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
				local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
				local _ = fileGetSize(file)&lt;br /&gt;
				Bytes = Bytes + _&lt;br /&gt;
				files[xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)] = _&lt;br /&gt;
				fileClose(file)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
--USEFUL FUNCTION&lt;br /&gt;
function refreshResource ()&lt;br /&gt;
local newBytes = 0&lt;br /&gt;
local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
	if meta then&lt;br /&gt;
		for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
			if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
			local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
			local _ = fileGetSize(file)&lt;br /&gt;
			newBytes = newBytes + _&lt;br /&gt;
			fileClose(file)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if newBytes ~= Bytes then&lt;br /&gt;
		print(getResourceName(getThisResource())..&amp;quot; has changed.. reloading...&amp;quot;)&lt;br /&gt;
		restartResource(getThisResource())&lt;br /&gt;
		else&lt;br /&gt;
		return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
TODO.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TODO&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46295</id>
		<title>RefreshResource</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RefreshResource&amp;diff=46295"/>
		<updated>2016-01-04T22:54:09Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__ This code refreshes your resource if any part of the code or some resource file has changed, it works just like &amp;quot;refreshResourc...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This code refreshes your resource if any part of the code or some resource file has changed, it works just like &amp;quot;refreshResources ()&amp;quot; but adapted for one particular resource&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;refreshResource()&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Return==&lt;br /&gt;
Returns '''false''' if none has changed&lt;br /&gt;
==code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local files = {}&lt;br /&gt;
local Bytes = 0&lt;br /&gt;
addEventHandler(&amp;quot;onResourceStart&amp;quot;, resourceRoot,&lt;br /&gt;
	function()&lt;br /&gt;
	local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
		if meta then&lt;br /&gt;
			for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
				if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
				local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
				local _ = fileGetSize(file)&lt;br /&gt;
				Bytes = Bytes + _&lt;br /&gt;
				files[xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)] = _&lt;br /&gt;
				fileClose(file)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
--USEFULL FUNCTION&lt;br /&gt;
function refreshResource ()&lt;br /&gt;
local newBytes = 0&lt;br /&gt;
local meta = xmlLoadFile(&amp;quot;:&amp;quot;..getResourceName(getThisResource())..&amp;quot;/meta.xml&amp;quot;)&lt;br /&gt;
	if meta then&lt;br /&gt;
		for k,v in ipairs(xmlNodeGetChildren(meta)) do&lt;br /&gt;
			if fileExists(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;)) then&lt;br /&gt;
			local file = fileOpen(xmlNodeGetAttribute(v, &amp;quot;src&amp;quot;))&lt;br /&gt;
			local _ = fileGetSize(file)&lt;br /&gt;
			newBytes = newBytes + _&lt;br /&gt;
			fileClose(file)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if newBytes ~= Bytes then&lt;br /&gt;
		print(getResourceName(getThisResource())..&amp;quot; has changed.. reloading...&amp;quot;)&lt;br /&gt;
		restartResource(getThisResource())&lt;br /&gt;
		else&lt;br /&gt;
		return false&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
TODO.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
TODO&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=CancelLatentEvent&amp;diff=45766</id>
		<title>CancelLatentEvent</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=CancelLatentEvent&amp;diff=45766"/>
		<updated>2015-08-19T16:44:46Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Needs_Example}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
Stops a latent event from completing&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&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 cancelLatentEvent( player thePlayer, int handle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePlayer:''' The player who is receiving the event.&lt;br /&gt;
*'''handle:''' A handle previous got from [[getLatentEventHandles]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&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 cancelLatentEvent( int handle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''handle:''' A handle previous got from [[getLatentEventHandles]].&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a true if the latent event was successfully cancelled, or false if it was not&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--TODO&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Requirements==&lt;br /&gt;
{{Requirements|1.3.0-9.03772|1.3.0-9.03772|}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Event functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineReplaceCOL&amp;diff=45765</id>
		<title>EngineReplaceCOL</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineReplaceCOL&amp;diff=45765"/>
		<updated>2015-08-19T16:41:53Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Note box|Please note the loading order that is used in the examples as other orders can cause collisions, textures or the DFF not to load due to technical limitations}}&lt;br /&gt;
&lt;br /&gt;
This function replaces the collision file of the given model id to the collision file passed. Use [[engineLoadCOL]] to load the collision file first.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Collision libraries (.col files containing multiple collision models) are not supported. See [[COL]] for details. Object models are supported only (no vehicles or players).&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool engineReplaceCOL ( col theCol, int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[COL|col]]:replace}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theCol:''' The collision file to replace with&lt;br /&gt;
*'''modelID:''' The model ID whose collision file you want to replace&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the collision was successfully replaced, ''false'' or ''nil'' if the collision could not be replaced for a reason.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Client-Side example for replacing object collision with custom one.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceCollision ( )&lt;br /&gt;
outputChatBox ( &amp;quot;&amp;gt; Replacing Collision Data.&amp;quot; )&lt;br /&gt;
col = engineLoadCOL( &amp;quot;myColFile.col&amp;quot; )&lt;br /&gt;
engineReplaceCOL( col, 3356 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;collisionReplace&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;collisionReplace&amp;quot;, root, ReplaceCollision )&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;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Server-side example function for triggering the replace.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceCols ( )&lt;br /&gt;
triggerClientEvent ( &amp;quot;collisionReplace&amp;quot;, root, collisionReplace )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;replacecol&amp;quot;, ReplaceCols)&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;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Element_tree&amp;diff=45764</id>
		<title>Element tree</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Element_tree&amp;diff=45764"/>
		<updated>2015-08-19T16:41:18Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Tree elements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Tre.png|frame|Element tree]]&lt;br /&gt;
MTA uses a so-called ''element tree'' to store all the elements that exist on the server and the client. This is directly related to the set of running [[resources]] and their map files' XML layout, although it can be changed at run-time by scripts.&lt;br /&gt;
&lt;br /&gt;
If you are familiar with the concept of ''trees'' in computer-science, this should be easy to understand. If you are not, think of it like a family tree - except everyone only has a single parent. Every [[element]] has a ''parent'' element.&lt;br /&gt;
&lt;br /&gt;
All elements that are created within scripts or from .map files are child elements of the resource they belong to. Thus, most elements (except for [[client]]s) exist only within resources and are also destroyed as soon as their resource is stopped.&lt;br /&gt;
&lt;br /&gt;
==Tree elements==&lt;br /&gt;
* '''root''': This is at the very base of the tree - all elements are children (or descendants) of this element.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
getRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''resource''': These are direct children of the root element - with one for each ''running'' resource. This element is called the ''resource root''. Its ID holds the name of the resource.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
getResourceRootElement()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
* '''map''': Each resource element contains at least one map element, representing either a &amp;quot;.map&amp;quot; file in the resource or the one containing the elements created by scripts (this is called the ''dynamic'' map). Their IDs contain the maps' filenames, or ''dynamic'' for the dynamic map.&lt;br /&gt;
** Map files can contain a number of other [[element]]s as well as an unlimited number of custom elements.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This in an example of a serverside tree dumped to XML from a running server.&lt;br /&gt;
''Please note that it is shortened on some places for the sake of overview.''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;root&amp;gt;&lt;br /&gt;
	&amp;lt;console/&amp;gt;&lt;br /&gt;
	&amp;lt;player dontRespawn=&amp;quot;false&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;player dontRespawn=&amp;quot;false&amp;quot; lastSpawnarea=&amp;quot;&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;resourcebrowser&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;ajax&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;resourcemanager&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;spawnmanager&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;mapmanager&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;runcode&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;fr&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;map id=&amp;quot;dynamic&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;vehicle/&amp;gt;&lt;br /&gt;
		&amp;lt;/map&amp;gt;&lt;br /&gt;
	&amp;lt;/resource&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;elementbrowser&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;assault&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;map id=&amp;quot;dynamic&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;team/&amp;gt;&lt;br /&gt;
			&amp;lt;team/&amp;gt;&lt;br /&gt;
			&amp;lt;blip/&amp;gt;&lt;br /&gt;
			&amp;lt;marker/&amp;gt;&lt;br /&gt;
			&amp;lt;colshape/&amp;gt;&lt;br /&gt;
			&amp;lt;blip/&amp;gt;&lt;br /&gt;
			&amp;lt;blip/&amp;gt;&lt;br /&gt;
		&amp;lt;/map&amp;gt;&lt;br /&gt;
	&amp;lt;/resource&amp;gt;&lt;br /&gt;
	&amp;lt;resource id=&amp;quot;as-farm&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;map id=&amp;quot;dynamic&amp;quot;/&amp;gt;&lt;br /&gt;
		&amp;lt;map id=&amp;quot;as-farm.map&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;spawngroup req=&amp;quot;&amp;quot; type=&amp;quot;attacker&amp;quot;&amp;gt;&lt;br /&gt;
				&amp;lt;spawnarea posY=&amp;quot;-8.3976354598999&amp;quot; posX=&amp;quot;20.182683944702&amp;quot; skins=&amp;quot;9&amp;quot; ... /&amp;gt;&lt;br /&gt;
			&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
			&amp;lt;spawngroup req=&amp;quot;&amp;quot; type=&amp;quot;attacker&amp;quot;&amp;gt;&lt;br /&gt;
				&amp;lt;spawnarea posY=&amp;quot;32.166355133057&amp;quot; posX=&amp;quot;-46.90763092041&amp;quot; skins=&amp;quot;9&amp;quot; ... /&amp;gt;&lt;br /&gt;
			&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
			&amp;lt;spawngroup req=&amp;quot;&amp;quot; type=&amp;quot;attacker&amp;quot;&amp;gt;&lt;br /&gt;
				&amp;lt;spawnarea posY=&amp;quot;35.214984893799&amp;quot; posX=&amp;quot;-33.486911773682&amp;quot; skins=&amp;quot;9&amp;quot; ... /&amp;gt;&lt;br /&gt;
			&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
			&amp;lt;spawngroup req=&amp;quot;&amp;quot; type=&amp;quot;attacker&amp;quot;&amp;gt;&lt;br /&gt;
				&amp;lt;spawnarea posY=&amp;quot;35.214984893799&amp;quot; posX=&amp;quot;-33.486911773682&amp;quot; skins=&amp;quot;9&amp;quot; ... /&amp;gt;&lt;br /&gt;
			&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
			&amp;lt;objective id=&amp;quot;first&amp;quot; type=&amp;quot;checkpoint&amp;quot; description=&amp;quot;Breach into the farm&amp;quot; ... /&amp;gt;&lt;br /&gt;
			&amp;lt;pickup type=&amp;quot;weapon&amp;quot; ... /&amp;gt;&lt;br /&gt;
		&amp;lt;/map&amp;gt;&lt;br /&gt;
	&amp;lt;/resource&amp;gt;&lt;br /&gt;
&amp;lt;/root&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
===Explanation===&lt;br /&gt;
This tree consists of a number of resource root elements, the [[Element/Console|server console]] and two [[player]] elements, that are direct children of the '''root''' element. All these resources have a ''dynamic map'' as child element (it is just not shown for most of them). These contain the elements that are created dynamically by this resource using scripts, for example a [[vehicle]]. If the resource has a map file, it is also a child element, itself containing all the elements in the .map file.&lt;br /&gt;
&lt;br /&gt;
Let's have a closer look at the '''assault''' resource: This contains just one ''dynamic'' map that has 2 teams, 3 blips, 1 marker and 1 colshape as child elements. These are the elements that are created by the script, for example the marker, the colshape and one of the blips are probably used for the objective.&lt;br /&gt;
&lt;br /&gt;
The '''as-farm''' resource's function on the contrary is to be a map for the '''assault''' gamemode. The dynamic map is empty (it could contain elements if there was a script in it though), while there is a map called 'as-farm.map', that contains a number of elements. These are mostly custom elements (like spawngroup, spawnarea, objective) but also a few elements that MTA creates automactically after loading the map (like pickup). In the brackets after the element type, you can see the element data it contains. These are identical with the attributes the .map file contains within these elements, while you can also set and get element data for any other elements (e.g. players) with [[setElementData]] and [[getElementData]].&lt;br /&gt;
&lt;br /&gt;
==Pratical application==&lt;br /&gt;
Elements can have as many children as they like. This does not directly affect the map in any way, but it comes in to its own when combined with the scripting system.&lt;br /&gt;
&lt;br /&gt;
===Setting data for elements===&lt;br /&gt;
If you call a set... function on a node of the element tree, the function will affect every element within it (that it can work on).&lt;br /&gt;
&lt;br /&gt;
So, the following code would set the size of every marker (the only type of element the setMarkerSize function can work on) that is below the root element to ''2.5''.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
setMarkerSize ( getRootElement(), 2.5 )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The same can be done on any element, it is not restricted to the root element.&lt;br /&gt;
&lt;br /&gt;
===Map manager===&lt;br /&gt;
The [[#Example|example above]] shows the way the [[map manager]] uses different resources. The 'assault' resource is the gamemode, that manages what happens on the server using scripts and thus by creating elements in the tree dynamically. When a map resource is started, the gamemode receives a [[resource|resource pointer]] referring to the started resource - in this case ''as-farm'' - from which you can retrieve and store the resource root element. Using this element in conjunction with functions like [[getElementsByType]], [[getElementData]] and various others, you can access any of the information that was loaded into the tree from the 'as-farm.map'-file through scripts in the gamemode resource.&lt;br /&gt;
&lt;br /&gt;
Another thing that has to be considered related to the tree of elements is the fact that when you change the map, you don't have to remove any elements you created within the map resource, while you '''do''' have to remove elements that are created within the gamemode resource, '''if''' they are specific to the map (which will be probably the case for those items you create based on information read from the map resource's .map files).&lt;br /&gt;
&lt;br /&gt;
==Element browser==&lt;br /&gt;
You can start the resource ''elementbrowser'' to see a live view of the element tree on your server. Just start the resource and browser to your server's web page and choose the ''Element browser'' option in the sidebar (firefox only currently).&lt;br /&gt;
[[Category:Scripting Concepts]]&lt;br /&gt;
[[es:Árbol de elementos]]&lt;br /&gt;
[[ru:Element tree]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineReplaceModel&amp;diff=45763</id>
		<title>EngineReplaceModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineReplaceModel&amp;diff=45763"/>
		<updated>2015-08-19T16:38:03Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Note box|Please note the loading order that is used in the examples as other orders can cause collisions, textures or the DFF not to load due to technical limitations}}&lt;br /&gt;
&lt;br /&gt;
This function replaces the given model in the given model ID with the DFF file passed. This function supports vehicles and objects at the moment.&lt;br /&gt;
&lt;br /&gt;
As of 1.1.1 This supports Ped and Weapon models. For replace weapon models you can't use weapon ID's, you should use object ID's. All weapon model ID's here: [[Weapons]].&lt;br /&gt;
&lt;br /&gt;
Note: Due to a bug, when replacing models with built in collisions (i.e. vehicles), the collision may not get replaced correctly. The current work around is to load the dff again and do another replace after a short delay.&lt;br /&gt;
{{Note|To replace models in the original GTA map, use one of the [[EngineReplaceModel notes|methods shown here]]}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool engineReplaceModel ( dff theModel, int modelID [, bool alphaTransparency = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[DFF|dff]]:replace}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theModel:''' The model to replace the given model ID with&lt;br /&gt;
*'''modelID:''' The model it to replace the model of&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''alphaTransparency:''' Set to true to enable special thing&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the model was successfully replaced, ''false'' if it failed for some reason, ie. the DFF or the model ID is not valid.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
'''Example 1:'''&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Client-Side example for replacing vehicle model and texture with custom ones.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceVehicle ( )&lt;br /&gt;
outputChatBox ( &amp;quot;&amp;gt; replacing the euros vehicle&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
txd = engineLoadTXD ( &amp;quot;data/euros.txd&amp;quot; )&lt;br /&gt;
engineImportTXD ( txd, 587 )&lt;br /&gt;
dff = engineLoadDFF ( &amp;quot;data/euros.dff&amp;quot; )&lt;br /&gt;
engineReplaceModel ( dff, 587 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;replaceVeh&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;replaceVeh&amp;quot;, root, ReplaceVehicle )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Server-side example function for triggering the replace.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceCommand ( )&lt;br /&gt;
triggerClientEvent( &amp;quot;replaceVeh&amp;quot;, root, replaceVeh )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;replace&amp;quot;, ReplaceCommand )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:'''&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Client-Side example for replacing object collision, texture and model with custom ones.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceObject ( )&lt;br /&gt;
&lt;br /&gt;
col = engineLoadCOL( &amp;quot;MyModel.col&amp;quot; )&lt;br /&gt;
txd = engineLoadTXD( &amp;quot;MyModel.txd&amp;quot; )&lt;br /&gt;
dff = engineLoadDFF( &amp;quot;MyModel.dff&amp;quot;, 0 )&lt;br /&gt;
&lt;br /&gt;
engineReplaceCOL( col, 1234 )&lt;br /&gt;
engineImportTXD( txd, 1234 )&lt;br /&gt;
engineReplaceModel( dff, 1234 )-- replace the model at least&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;replaceObj&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;replaceObj&amp;quot;, root, ReplaceObject )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Server-side example function for triggering the replace.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ReplaceCommand ( )&lt;br /&gt;
triggerClientEvent( &amp;quot;replaceObj&amp;quot;, root, replaceObj )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;replace&amp;quot;, ReplaceCommand )&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;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=EngineRestoreModel&amp;diff=45762</id>
		<title>EngineRestoreModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=EngineRestoreModel&amp;diff=45762"/>
		<updated>2015-08-19T16:36:49Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&amp;lt;!-- Change this to &amp;quot;Client function&amp;quot; or &amp;quot;Server function&amp;quot; appropriately--&amp;gt;&lt;br /&gt;
&amp;lt;!-- Describe in plain english what this function does. Don't go into details, just give an overview --&amp;gt;&lt;br /&gt;
This function restores the visual DFF and TXD model of the given model ID. This restores the result of [[engineReplaceModel]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd --&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool engineRestoreModel ( int modelID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||Engine.restoreModel}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
&amp;lt;!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type --&amp;gt;&lt;br /&gt;
*'''modelID:''' The model ID to restore the visuals of&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
&amp;lt;!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check --&amp;gt;&lt;br /&gt;
Returns ''true'' if the model was successfully restored, ''false'' or ''nil'' if it failed for some reason.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;!-- Explain what the example is in a single sentance --&amp;gt;&lt;br /&gt;
&amp;lt;!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Client-Side example for restoring model / vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function ResetModel ( )&lt;br /&gt;
    engineRestoreModel ( 587 )  -- Object / Vehicle to restore to default GTA one.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEvent ( &amp;quot;restoreClientModel&amp;quot;, true )&lt;br /&gt;
addEventHandler ( &amp;quot;restoreClientModel&amp;quot;, root, ResetModel )&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;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Server-Side example for triggering model / vehicle restore function with &amp;quot;restore&amp;quot; command.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function RestoreModel ( )&lt;br /&gt;
    triggerClientEvent ( &amp;quot;restoreClientModel&amp;quot;, root, restoreClientModel )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;restore&amp;quot;, RestoreModel )&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;
&amp;lt;!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc --&amp;gt;&lt;br /&gt;
{{Engine_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementPosition&amp;diff=45761</id>
		<title>SetElementPosition</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementPosition&amp;diff=45761"/>
		<updated>2015-08-19T16:32:23Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the position of an element to the specified coordinates.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #FF7070; border: 3px solid #FF0000;&amp;quot;&amp;gt;&lt;br /&gt;
'''Attention:''' Do not use this function to spawn a [[ped]]/[[player]]. It will cause problems with other functions like [[warpPedIntoVehicle]]. &amp;lt;br&amp;gt;&lt;br /&gt;
Use [[spawnPlayer]] and [[createPed]] instead.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:setPosition|position|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' A valid [[element]] to be moved.&lt;br /&gt;
*'''x:''' The x coordinate of the destination.&lt;br /&gt;
*'''y:''' The y coordinate of the destination.&lt;br /&gt;
*'''z:''' The z coordinate of the destination.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''warp:''' teleports players, resetting any animations they were doing. Setting this to ''false'' preserves the current animation.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successful, ''false'' otherwise.&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 adds a &amp;quot;setpos&amp;quot; command to console, which allows setting of a player's position.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( source, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a &amp;quot;setpos&amp;quot; command to console, which allows setting of the local player's position.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleSetPlayerPosition ( commandName, posX, posY, posZ )&lt;br /&gt;
	setElementPosition ( localPlayer, posX, posY, posZ )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;setpos&amp;quot;, consoleSetPlayerPosition  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 3&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
This example enables a player to type /warpto &amp;lt;playername&amp;gt; to warp to them. If the player being warped to is in a vehicle with a free passenger seat, it will warp into the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function consoleWarpTo ( sourcePlayer, commandName, player2nick )&lt;br /&gt;
	-- Make sure required parameters are set&lt;br /&gt;
	if ( not sourcePlayer or not player2nick ) then return end&lt;br /&gt;
	-- Setup the variables we will be using for teleportation&lt;br /&gt;
	local x, y, z, r, d = 0, 0, 0, 0, 2.5&lt;br /&gt;
	-- Grab the element identifier of the player we are trying to warp to&lt;br /&gt;
	local player2 = getPlayerFromNick ( player2nick )&lt;br /&gt;
	-- Make sure it exists!&lt;br /&gt;
	if ( player2 ) then&lt;br /&gt;
		-- Is the player we're warping to in a vehicle?&lt;br /&gt;
		if ( isPlayerInVehicle ( player2 ) ) then&lt;br /&gt;
			-- Indeed they are, let's get the vehicle information such as the vehicle element itself, and the seats it's got.&lt;br /&gt;
			local player2vehicle = getPlayerOccupiedVehicle ( player2 )&lt;br /&gt;
			local numseats = getVehicleMaxPassengers ( player2vehicle )&lt;br /&gt;
			local i = 0&lt;br /&gt;
			-- Loop over the seats to see if there's a free one&lt;br /&gt;
			while ( i &amp;lt; numseats ) do&lt;br /&gt;
				if ( getVehicleOccupant ( player2vehicle, i ) ) then&lt;br /&gt;
					-- This seat isn't free, go ahead and check the next one&lt;br /&gt;
					i = i + 1&lt;br /&gt;
				else&lt;br /&gt;
					-- This seat is free, get out of the loop&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			-- Check if 'i' is lower than the number of seats. If it is, it means it's the number of a free seat&lt;br /&gt;
			if ( i &amp;lt; numseats ) then&lt;br /&gt;
				-- Teleport the player into the seat&lt;br /&gt;
				warpPlayerIntoVehicle ( sourcePlayer, player2vehicle, i )&lt;br /&gt;
			else&lt;br /&gt;
				-- There are no free seats, tell the player that.&lt;br /&gt;
				outputChatBox ( &amp;quot;Sorry, the player's vehicle is full (&amp;quot; .. getVehicleName ( player2vehicle ) .. &amp;quot; &amp;quot; .. i .. &amp;quot;/&amp;quot; .. numseats .. &amp;quot;)&amp;quot;, sourcePlayer )&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- The player isn't in a vehicle, let's get the player's position and warp to them.&lt;br /&gt;
			x, y, z = getElementPosition ( player2 )&lt;br /&gt;
			r = getPlayerRotation ( player2 )&lt;br /&gt;
			-- Make sure we get interior data, they might be inside one!&lt;br /&gt;
			interior = getElementInterior ( player2 )&lt;br /&gt;
			dimension = getElementDimension ( player2 )&lt;br /&gt;
			-- Do some funky math to make sure that we dont teleport inside of them (get us both stuck inside each other)&lt;br /&gt;
			x = x - ( ( math.cos ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			y = y - ( ( math.sin ( math.rad ( r + 90 ) ) ) * d )&lt;br /&gt;
			-- Set a few timers for setting interiors, dimensions and positions&lt;br /&gt;
			setTimer ( setElementInterior, 800, 1, sourcePlayer, interior )&lt;br /&gt;
			setTimer ( setElementDimension, 900, 1, sourcePlayer, dimension )&lt;br /&gt;
			setTimer ( setElementPosition, 1000, 1, sourcePlayer, x, y, z )&lt;br /&gt;
			setTimer ( setPlayerRotation, 1000, 1, sourcePlayer, r )&lt;br /&gt;
			-- Fade the camera to make it look nicer&lt;br /&gt;
			fadeCamera ( sourcePlayer, false, 1, 0, 0, 0 )&lt;br /&gt;
			-- Fade it back once it's all complete!&lt;br /&gt;
			setTimer ( fadeCamera, 1000, 1, sourcePlayer, true, 1 )&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- No player by the specified name was found, tell the warper this.&lt;br /&gt;
		outputChatBox ( &amp;quot;No such player.&amp;quot;, sourcePlayer )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;warpto&amp;quot;, consoleWarpTo )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementInterior&amp;diff=45760</id>
		<title>SetElementInterior</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementInterior&amp;diff=45760"/>
		<updated>2015-08-19T16:29:58Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to set the [[interior]] of any element. An interior is the current loaded place, 0 being outside.&lt;br /&gt;
{{Note|If passing the same interior as the element is in, the call will be ignored and position (optional arguments) will not be set either. Use [[setElementPosition]] separately to be sure the position will be set.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementInterior ( element theElement, int interior [, float x, float y, float z] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:setInterior||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element in which you'd like to set the interior of.&lt;br /&gt;
*'''interior:''' The interior you want to set the element to. Valid values are 0 to 255.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
* '''x:''' A floating point number representing the X coordinate on the map.&lt;br /&gt;
* '''y:''' A floating point number representing the Y coordinate on the map.&lt;br /&gt;
* '''z:''' A floating point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if '''theElement''' and '''interior''' are valid arguments, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
In this example, if a player were to type /interior 1, they would be teleported into this interior&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function interior ( source, commandName, interior )&lt;br /&gt;
  --Let's see if they gave an interior ID&lt;br /&gt;
  if ( interior ) then&lt;br /&gt;
    --They did, so lets assign them to that interior and teleport them there (all in 1 function call!)&lt;br /&gt;
    setElementInterior ( source, interior, 2233.91, 1714.73, 1011.38 )&lt;br /&gt;
  else&lt;br /&gt;
    --They didn't give one, so set them to the interior they wanted, but don't teleport them.&lt;br /&gt;
    setElementInterior ( source, 0 )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;interior&amp;quot;, interior )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
In this example, if a player were to type /interior 1, they would be teleported into this interior&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function interior ( commandName, interior )&lt;br /&gt;
  --Let's see if they gave a interior ID&lt;br /&gt;
  if ( interior ) then&lt;br /&gt;
    --They did, so let's assign them to that interior and teleport them there (all in 1 function call!)&lt;br /&gt;
    setElementInterior ( localPlayer, interior, 2233.91, 1714.73, 1011.38 )&lt;br /&gt;
  else&lt;br /&gt;
    --They didn't give one, so set them to the interior they wanted, but don't teleport them.&lt;br /&gt;
    setElementInterior ( localPlayer, 0 )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;interior&amp;quot;, interior )&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;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:setElementInterior]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementDimension&amp;diff=45759</id>
		<title>SetElementDimension</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementDimension&amp;diff=45759"/>
		<updated>2015-08-19T16:25:56Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function allows you to set the [[dimension]] of any element. The dimension determines what/who the element is visible to.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementDimension ( element theElement, int dimension )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:setDimension|dimension|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element in which you'd like to set the dimension of.&lt;br /&gt;
*'''dimension:''' An integer representing the dimension ID&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if '''theElement''' and '''dimension''' are valid, ''false'' otherwise.&lt;br /&gt;
Also returns false if '''theElement''' is a player and it's not alive.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
In this example the player's dimension is set to ID 1 when they enter a vehicle, and set back to dimension 0 when they exit the vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
      if ( getElementDimension ( source ) == 0 ) then    -- if the player is in dimension 0&lt;br /&gt;
            setElementDimension ( source, 1 )            -- set his dimension to 1&lt;br /&gt;
            setElementDimension ( theVehicle, 1 )        -- set his vehicle's dimension to 1 as well&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, onPlayerEnterVehicle )&lt;br /&gt;
&lt;br /&gt;
function onPlayerExitVehicle ( theVehicle, seat, jacker )&lt;br /&gt;
      if ( getElementDimension ( source ) == 1 ) then    -- if the player is in dimension 1&lt;br /&gt;
            setElementDimension ( source, 0 )            -- set his dimension back to 0&lt;br /&gt;
            setElementDimension ( theVehicle, 0 )        -- set his vehicle's dimension back to 0 as well&lt;br /&gt;
      end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, onPlayerExitVehicle )&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;
{{Element functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:setElementDimension]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetElementAttachedOffsets&amp;diff=45758</id>
		<title>SetElementAttachedOffsets</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetElementAttachedOffsets&amp;diff=45758"/>
		<updated>2015-08-19T16:24:35Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function updates the offsets of an element that has been attached to another element using [[attachElements]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setElementAttachedOffsets ( element theElement, [ float xPosOffset, float yPosOffset, float zPosOffset, float xRotOffset, float yRotOffset, float zRotOffset ])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:setAttachedOffsets||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The attached element.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''xPosOffset:''' The x offset, if you want the elements to be a certain distance from one another (default 0).&lt;br /&gt;
*'''yPosOffset:''' The y offset (default 0).&lt;br /&gt;
*'''zPosOffset:''' The z offset (default 0).&lt;br /&gt;
*'''xRotOffset:''' The x rotation offset (default 0).&lt;br /&gt;
*'''yRotOffset:''' The y rotation offset (default 0).&lt;br /&gt;
*'''zRotOffset:''' The z rotation offset (default 0).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the attaching process was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
'''Example:''' This example creates a car with a minigun&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Offsets&lt;br /&gt;
local x,y,z,rx,ry,rz= 0,-1.5,-0.1,0,0,-90&lt;br /&gt;
&lt;br /&gt;
function createArmedBobcat(cmd)&lt;br /&gt;
    local lx,ly,lz = getElementPosition(root) -- get the position of the player&lt;br /&gt;
    lx = lx + 5 -- add 5 units to the x position&lt;br /&gt;
    &lt;br /&gt;
    veh = createVehicle( 422, lx, ly, lz) -- create a bobcat&lt;br /&gt;
    base = createObject( 2985, 2,2,2) -- create a minigun_base object&lt;br /&gt;
    setElementCollisionsEnabled ( base, false ) -- the minigun_base damages the car&lt;br /&gt;
    -- you could alternatively load an empty col file for the minigun object&lt;br /&gt;
    attachElements ( base, veh,  x,y,z,rx,ry,rz) -- attach the base to the bobcat&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function rotateIt(cmd, addZ)&lt;br /&gt;
    if(addZ) then&lt;br /&gt;
        rz=rz+addZ&lt;br /&gt;
        setElementAttachedOffsets (base,x,y,z,rx,ry,rz) --update offsets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;bobcat&amp;quot;, createArmedBobcat)&lt;br /&gt;
addCommandHandler(&amp;quot;rotate&amp;quot;, rotateIt)&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetRootElement&amp;diff=45757</id>
		<title>GetRootElement</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetRootElement&amp;diff=45757"/>
		<updated>2015-08-19T16:19:02Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the root node of the [[element tree]], called ''root''. This node contains every other element: all resource root elements, players and remote clients. It is never destroyed and cannot be destroyed using [[destroyElement]].&lt;br /&gt;
&lt;br /&gt;
It is often used to attach handler functions to events triggered for any element, or also to make a scripting function affect all elements.&lt;br /&gt;
{{Note|All resources have a [[Predefined_variables_list|predefined global variable]] called ''root'' that has the root element as value. The variable exists server side as well as client side.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element getRootElement ( )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the root [[element]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will output the number of loaded resources by counting ''resource'' elements that are children of the ''root'' node.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--By default, predefined variable 'root' is getRootElement()&lt;br /&gt;
local rootChildren = getElementChildren( root )&lt;br /&gt;
&lt;br /&gt;
local resourceCount = 0&lt;br /&gt;
for k, child in ipairs( rootChildren ) do&lt;br /&gt;
	if getElementType( child ) == &amp;quot;resource&amp;quot; then&lt;br /&gt;
		resourceCount = resourceCount + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
outputChatBox( &amp;quot;There are &amp;quot; .. resourceCount .. &amp;quot; loaded resources.&amp;quot; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;br /&gt;
[[ru:getRootElement]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementType&amp;diff=45756</id>
		<title>GetElementType</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementType&amp;diff=45756"/>
		<updated>2015-08-19T16:16:38Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to retrieve the type of an element.&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 getElementType ( element theElement )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:getType|type|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] you wish to get the type of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''string'' containing the element type, ''false'' if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example destroys a haystack when a player targets it&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerTarget ( targetElem )&lt;br /&gt;
    -- if the targeted object is a haystack (an object with model ID 3374) remove it from the game&lt;br /&gt;
    if getElementType ( targetElem ) == &amp;quot;object&amp;quot; and getElementModel ( targetElem ) == 3374 then&lt;br /&gt;
        destroyElement ( targetElem )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerTarget&amp;quot;, root, onPlayerTarget )    -- add above function as handler for targeting event&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementRotation&amp;diff=45755</id>
		<title>GetElementRotation</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementRotation&amp;diff=45755"/>
		<updated>2015-08-19T16:15:22Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
Retrieve the rotation of elements.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float float float getElementRotation ( element theElement [, string rotOrder = &amp;quot;default&amp;quot; ] )       &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:getRotation|rotation|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element whose rotation will be retrieved&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''rotOrder:''' A string representing the rotation order desired when returning the [http://en.wikipedia.org/wiki/Euler_angles euler angles]. If omitted, default value is ''&amp;quot;default&amp;quot;''. Allowed values are:&lt;br /&gt;
**''&amp;quot;default&amp;quot;:'' default MTA behavior prior to 1.1, where rotation order depends on element type&lt;br /&gt;
**''&amp;quot;ZXY&amp;quot;:'' rotation about the Z axis (''up''), then about the resulting X axis (''right'') and finally about the resulting Y axis (''front''). This is the default rotation order for [[object|objects]]&lt;br /&gt;
**''&amp;quot;ZYX&amp;quot;:'' rotation about the Z axis (''up''), then about the resulting Y axis (''front''), and finally about the resulting X axis (''right''). This is the default rotation order for [[vehicle|vehicles]]&lt;br /&gt;
&lt;br /&gt;
The default rotation order for peds/players is Z-Y-X (clientside) and -Z-Y-X (serverside) but those rotation orders (set using ''&amp;quot;default&amp;quot;'' on peds) can not be used manually on other element types since they only exist due to historical and backward compatibility reasons.&lt;br /&gt;
Specifying a rotation order other than ''&amp;quot;default&amp;quot;'' allows the same angles to later be uniformly used on several elements without having to consider their type.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
* ''rx, ry, rz'': 3 ''float''s representing the Euler rotation angles on the axis X, Y and Z (with the rotation order depending on the ''rotOrder'' argument) if ''element'' exists and is a valid element, ''false'' if it's invalid.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
If a player points at a player element with a gun, its rotation will appear in the chat box.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&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;
function onPlayerTargeted ( targetElem )&lt;br /&gt;
    if ( isElement(targetElem) and getElementType (targetElem) == &amp;quot;player&amp;quot; ) then&lt;br /&gt;
        local x,y,z = getElementRotation ( targetElem )&lt;br /&gt;
        outputChatBox ( &amp;quot;Target player rotation: &amp;quot; .. x .. &amp;quot; &amp;quot; .. y .. &amp;quot; &amp;quot; .. z )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPlayerTarget&amp;quot;, root, onPlayerTargeted )&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;
{{Client_element_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementParent&amp;diff=45754</id>
		<title>GetElementParent</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementParent&amp;diff=45754"/>
		<updated>2015-08-19T16:14:13Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to determine the parent of an ''element''.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
element getElementParent ( element theElement )  &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:getParent|parent|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The child of the parent element you want returned.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This returns the parent as an ''element''. It returns ''false'' if ''theElement'' is invalid, or is the root node.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
Consider the following map file:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;spawngroup id=&amp;quot;red&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint_0&amp;quot; posX=&amp;quot;2507.8715820313&amp;quot; posY=&amp;quot;2772.6071777344&amp;quot; posZ=&amp;quot;10.8203125&amp;quot; rot=&amp;quot;270&amp;quot; skin=&amp;quot;285&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint_1&amp;quot; posX=&amp;quot;2508.060546875&amp;quot; posY=&amp;quot;2780.3647460938&amp;quot; posZ=&amp;quot;10.8203125&amp;quot; rot=&amp;quot;270&amp;quot; skin=&amp;quot;285&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
&amp;lt;spawngroup id=&amp;quot;blue&amp;quot;&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint_5&amp;quot; posX=&amp;quot;2733.4184570313&amp;quot; posY=&amp;quot;2753.1276855469&amp;quot; posZ=&amp;quot;10.8203125&amp;quot; rot=&amp;quot;90&amp;quot; skin=&amp;quot;124&amp;quot;/&amp;gt;&lt;br /&gt;
   &amp;lt;spawnpoint id=&amp;quot;spawnpoint_6&amp;quot; posX=&amp;quot;2733.5258789063&amp;quot; posY=&amp;quot;2748.1110839844&amp;quot; posZ=&amp;quot;10.8203125&amp;quot; rot=&amp;quot;90&amp;quot; skin=&amp;quot;125&amp;quot;/&amp;gt;&lt;br /&gt;
&amp;lt;/spawngroup&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function determines a spawnpoint's parent element, and announces its ID:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function spawnpointUse ( thePlayer )             -- this function gets called whenever a spawnpoint is used&lt;br /&gt;
   theSpawnGroup = getElementParent ( source )   -- get the spawnpoint's parent element&lt;br /&gt;
   -- announce the parent's ID and the player who spawned there:&lt;br /&gt;
   outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; spawned at team &amp;quot; .. getElementID ( theSpawnGroup ) .. &amp;quot;'s spawnpoint.&amp;quot; )&lt;br /&gt;
   -- Example output: &amp;quot;Joe spawned at team blue's spawnpoint.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onSpawnpointUse&amp;quot;, root, spawnpointUse )&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;
{{element_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementModel&amp;diff=45753</id>
		<title>GetElementModel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementModel&amp;diff=45753"/>
		<updated>2015-08-19T16:13:21Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
&lt;br /&gt;
Returns the model ID of a given element. This can be a player/ped skin, a pickup model, an object model or a vehicle model.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getElementModel ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getModel|model|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' the element to retrieve the model ID of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the model ID if successful, ''false'' otherwise.&lt;br /&gt;
* For players/peds: A GTASA player model (skin) ID. See [[Character Skins]].&lt;br /&gt;
* For vehicles: The [[Vehicle IDs|vehicle ID]] of the vehicle.&lt;br /&gt;
* For objects: An [[int]] specifying the model id.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section class=&amp;quot;server&amp;quot; name=&amp;quot;Example 1 (Server)&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example destroys a haystack when a player targets it.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerTargeted ( targetElem )&lt;br /&gt;
    if ( getElementType ( targetElem ) == &amp;quot;object&amp;quot; ) and ( getElementModel ( targetElem ) == 3374 ) then&lt;br /&gt;
        destroyElement ( targetElem )&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerTarget&amp;quot;, root, onPlayerTargeted )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section class=&amp;quot;server&amp;quot; name=&amp;quot;Example 2 (Server)&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example prints out a message when a Shamal or AT-400 is entered by a player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function planeEnter ( theVehicle, seat, jacked ) -- when someone enters a vehicle&lt;br /&gt;
    local id = getElementModel ( theVehicle ) -- get the model ID of the vehicle&lt;br /&gt;
    if id == 519 or id == 577 then -- if theVehicle is either Shamal or AT-400&lt;br /&gt;
        local vehicleName = getVehicleName ( theVehicle ) -- get the name of theVehicle&lt;br /&gt;
        outputChatBox ( &amp;quot;Someone stole a &amp;quot; .. vehicleName .. &amp;quot;!&amp;quot; ) -- announce that someone stole the plane&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
-- add the event handler to the event&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, planeEnter )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementHealth&amp;diff=45752</id>
		<title>GetElementHealth</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementHealth&amp;diff=45752"/>
		<updated>2015-08-19T16:10:59Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function returns the current health for the specified [[element]]. This can be a [[player]], a [[ped]], or a [[vehicle]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float getElementHealth ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getHealth|health|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The [[player]] or [[vehicle]] whose health you want to check.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a float indicating the element's health, or ''false'' if invalid arguments were passed.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Clientside example&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example outputs the health of the player who enters the command 'showhealth', and their vehicle's health.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function showLocalHealth()&lt;br /&gt;
	-- get the player's health and output it&lt;br /&gt;
	local playerHealth = getElementHealth ( localPlayer )&lt;br /&gt;
	outputChatBox ( &amp;quot;Your health: &amp;quot; .. playerHealth )&lt;br /&gt;
&lt;br /&gt;
	-- get the player's vehicle: if he is in one, output its health as well&lt;br /&gt;
	local playerVehicle = getPedOccupiedVehicle ( localPlayer )&lt;br /&gt;
	if playerVehicle then&lt;br /&gt;
		local vehicleHealth = getElementHealth ( playerVehicle ) / 10  -- Divide this by 10, as default the denominator is 1000&lt;br /&gt;
		outputChatBox ( &amp;quot;Your vehicle's health: &amp;quot; .. vehicleHealth )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;showhealth&amp;quot;, showLocalHealth )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementDimension&amp;diff=45751</id>
		<title>GetElementDimension</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementDimension&amp;diff=45751"/>
		<updated>2015-08-19T16:08:32Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function allows you to retrieve the dimension of any element. The dimension determines what/who the element is visible to.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getElementDimension ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getDimension|dimension|}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The element in which you'd like to retrieve the dimension of.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an integer for the dimension if '''theElement''' is valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example puts all vehicles with drivers in dimension 1, while all other vehicles are in dimension 0. This would have the effect of making on-foot players invisible to drivers, and vice versa. It'd also make entering a vehicle as passenger after the driver has entered impossible, as the vehicle would appear to vanish to any on foot players.&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    if ( getElementDimension ( source ) == 0 and seat == 0 ) then -- if the player is in dimension 0 and is entering the driver seat&lt;br /&gt;
        setElementDimension ( source, 1 )     -- set his dimension to 1&lt;br /&gt;
        setElementDimension ( theVehicle, 1 ) -- set his vehicle's dimension to 1 as well&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, onPlayerEnterVehicle )&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
function onPlayerExitVehicle ( theVehicle, seat, jacker )&lt;br /&gt;
    if ( getElementDimension ( source ) == 1 and seat == 0 ) then -- if the player is in dimension 1 and was in the driver's seat&lt;br /&gt;
        setElementDimension ( source, 0 )     -- set his dimension back to 0&lt;br /&gt;
        setElementDimension ( theVehicle, 0 ) -- set his vehicle's dimension back to 0 as well&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, onPlayerExitVehicle )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementData&amp;diff=45750</id>
		<title>GetElementData</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementData&amp;diff=45750"/>
		<updated>2015-08-19T16:06:06Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function retrieves [[element data]] attached to an element under a certain key.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;var getElementData ( element theElement, string key [, inherit = true] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getData||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' This is the element with data you want to retrieve.&lt;br /&gt;
*'''key:''' The name of the element data entry you want to retrieve. (Maximum 31 characters.)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''inherit:''' - toggles whether or not the function should go up the hierarchy to find the requested key in case the specified element doesn't have it.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns a ''variable'' containing the requested element data, or ''false'' if the element or the element data does not exist. When getting data corresponding to a XML attribute, this is always a ''string''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example stores the tick count when a player joins and then allows players to see how long they are connected using a console function 'joinTime'.&lt;br /&gt;
&amp;lt;section show=&amp;quot;true&amp;quot; name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function joinTime ( )&lt;br /&gt;
    setElementData ( source, &amp;quot;joinTime&amp;quot;, getTickCount() ) -- Store the current tick count in the player's data with the key 'joinTime'&lt;br /&gt;
end&lt;br /&gt;
-- Make our 'joinTime' function be called when a player joins&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerJoin&amp;quot;, root, joinTime )&lt;br /&gt;
&lt;br /&gt;
function showJoinTime ( source, commandName, playerName )&lt;br /&gt;
	if ( playerName ) then -- see if a player was specified&lt;br /&gt;
		thePlayer = getPlayerFromName ( playerName ) -- get the player element for the specified player&lt;br /&gt;
		if ( thePlayer ) then -- if one was found...&lt;br /&gt;
			local timeOnline = (getTickCount() - getElementData ( thePlayer, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculates the time since join&lt;br /&gt;
			outputChatBox ( getPlayerName ( thePlayer )..&amp;quot; joined &amp;quot;..timeOnline..&amp;quot; seconds ago&amp;quot;, source ) -- output the player's join time&lt;br /&gt;
		else&lt;br /&gt;
			outputChatBox ( &amp;quot;Couldn't find '&amp;quot; .. playerName .. &amp;quot;'&amp;quot;, source ) -- display an error&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- display when the player who used the function joined and inform how to see other people's join time&lt;br /&gt;
		local timeOnline = (getTickCount() - getElementData ( source, &amp;quot;joinTime&amp;quot; )) / 1000 -- calculate the time since join&lt;br /&gt;
		outputChatBox ( &amp;quot;You joined &amp;quot; ..timeOnline..&amp;quot; seconds ago&amp;quot;, source )&lt;br /&gt;
		outputChatBox ( &amp;quot;Use 'join_time &amp;lt;player name&amp;gt;' to see other people's join time&amp;quot;, source )&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
-- Add a console command joinTime, that takes an optional parameter of a player's name&lt;br /&gt;
addCommandHandler ( &amp;quot;joinTime&amp;quot;, showJoinTime )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementAttachedOffsets&amp;diff=45749</id>
		<title>GetElementAttachedOffsets</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementAttachedOffsets&amp;diff=45749"/>
		<updated>2015-08-19T15:58:10Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function returns the offsets of an element that has been attached to another element using [[attachElements]].&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float, float, float, float, float, float getElementAttachedOffsets ( element theElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:getAttachedOffsets||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The attached element.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns 6 [[float|floats]], of which the first 3 indicate the position offset (x, y, z), and the last 3 indicate the rotation offset (x, y, z), if successful. ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
'''Example:''' This example creates a car with a minigun&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Offsets&lt;br /&gt;
local x,y,z,rx,ry,rz= 0,-1.5,-0.1,0,0,-90&lt;br /&gt;
&lt;br /&gt;
function createArmedBobcat(cmd)&lt;br /&gt;
    local lx, ly, lz = getElementPosition(localPlayer) -- get the position of the player&lt;br /&gt;
    lx = lx + 5 -- add 5 units to the x position&lt;br /&gt;
    &lt;br /&gt;
    veh = createVehicle( 422, lx, ly, lz) -- create a bobcat&lt;br /&gt;
    base = createObject( 2985, 2,2,2) -- create a minigun_base object&lt;br /&gt;
    setElementCollisionsEnabled ( base, false ) -- the minigun_base damages the car&lt;br /&gt;
    -- you could alternatively load an empty col file for the minigun object&lt;br /&gt;
    attachElements ( base, veh,  x,y,z,rx,ry,rz) -- attach the base to the bobcat&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function rotateIt(cmd, addZ)&lt;br /&gt;
    if(addZ) then&lt;br /&gt;
        local x, y, z, rx, ry, rz = getElementAttachedOffsets (base) -- get the offsets&lt;br /&gt;
        rz = rz + addZ&lt;br /&gt;
        setElementAttachedOffsets (base, x, y, z, rx, ry, rz) -- update offsets&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addCommandHandler(&amp;quot;bobcat&amp;quot;, createArmedBobcat)&lt;br /&gt;
addCommandHandler(&amp;quot;rotate&amp;quot;, rotateIt)&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DestroyElement&amp;diff=45748</id>
		<title>DestroyElement</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DestroyElement&amp;diff=45748"/>
		<updated>2015-08-19T15:55:40Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function destroys an [[element]] and all elements within it in the hierarchy (its children, the children of those children etc). [[player|Player]] elements cannot be destroyed using this function. A player can only be removed from the hierarchy when they quit or are kicked. The root element also cannot be destroyed, however, passing the root as an argument will wipe all elements from the server, except for the players and clients, which will become direct descendants of the root node, and other elements that cannot be destroyed, such as resource root elements.&lt;br /&gt;
&lt;br /&gt;
Players are not the only elements that cannot be deleted. This list also includes remote clients and console elements.&lt;br /&gt;
{{Note|As element ids are eventually recycled, always make sure you nil variables containing the element after calling this function}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool destroyElement ( element elementToDestroy )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:destroy||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''elementToDestroy:''' The element you wish to destroy. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the element was destroyed successfully, ''false'' if either the element passed to it was invalid or it could not be destroyed for some other reason (for example, clientside destroyElement can't destroy serverside elements).&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
'''Example 1:''' This example would destroy every element in the map, with the exception of players and the root element itself.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- Destroy all its children, except players.&lt;br /&gt;
destroyElement ( root )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 2:''' This example destroys all vehicles of the specified model:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function destroyVehiclesOfModel(modelID)&lt;br /&gt;
	-- get a table of all the vehicles that exist and loop through it&lt;br /&gt;
	local vehicles = getElementsByType(&amp;quot;vehicle&amp;quot;)&lt;br /&gt;
	for i,v in ipairs(vehicles) do&lt;br /&gt;
		-- if the vehicle's ID is the one provided, destroy it&lt;br /&gt;
		if (getElementModel(v) == modelID) then&lt;br /&gt;
			destroyElement(v)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
destroyVehiclesOfModel(445)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Example 3:''' This example allows creation of claymores, which trigger and explode.  When they explode, the colshape and object for the claymore are destroyed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;function createClaymore ( x,y,z, creator )&lt;br /&gt;
	local claymoreObject = createObject ( 1945, x, y, z - 1, 0, 0, 90 )  -- create an object which looks like a claymore&lt;br /&gt;
	local claymoreCol = createColSphere ( x, y, z, 1 )                   -- create a col sphere with radius 1&lt;br /&gt;
	setElementData ( claymoreCol, &amp;quot;object&amp;quot;, claymoreObject )             -- store the object of the claymore&lt;br /&gt;
	setElementData ( claymoreCol, &amp;quot;creatorPlayer&amp;quot;, creator )             -- store the person who created it&lt;br /&gt;
	addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, claymoreCol, claymoreHit )        -- add an event handler to the colshape&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function claymoreHit ( thePlayer, matchingDimension )&lt;br /&gt;
	-- retrieve the object associated to the claymore, and who created it&lt;br /&gt;
	local claymoreObject = getElementData ( source, &amp;quot;object&amp;quot; )&lt;br /&gt;
	local claymoreCreator = getElementData ( source, &amp;quot;creatorPlayer&amp;quot; )&lt;br /&gt;
	-- get the position of the claymore&lt;br /&gt;
	local x,y,z = getElementPosition ( source )&lt;br /&gt;
	createExplosion ( x,y,z, 12, claymoreCreator ) -- create an explosion, associated to the creator, of a small size at the col's position&lt;br /&gt;
	-- remove the event handler for the colshape&lt;br /&gt;
	removeEventHandler ( &amp;quot;onColShapeHit&amp;quot;, source, claymoreHit )&lt;br /&gt;
	-- destroy the claymore object, and the col shape so it doesn't trigger again.&lt;br /&gt;
	destroyElement ( claymoreObject )&lt;br /&gt;
	destroyElement ( source )&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Example 4:''' This example destroys all vehicles, regardless of ID, name, etc:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function allvehiclesaredoomed()&lt;br /&gt;
	-- get a table of all the vehicles that exist and loop through it&lt;br /&gt;
	vehicles = getElementsByType(&amp;quot;vehicle&amp;quot;)&lt;br /&gt;
	for i,v in ipairs(vehicles) do&lt;br /&gt;
		-- destroy every vehicle.&lt;br /&gt;
		destroyElement(v)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
--The command handler below will destroy all vehicles once&lt;br /&gt;
--you enter /vdoom in the chat box or vdoom in the game console.&lt;br /&gt;
addCommandHandler(&amp;quot;vdoom&amp;quot;, allvehiclesaredoomed)&lt;br /&gt;
--This is very useful if you use the freeroam resource and some&lt;br /&gt;
--heartless players start spawn spamming.&lt;br /&gt;
--You can also set it on a timer to have your server clear all&lt;br /&gt;
--vehicles ever 60 minutes, (1 hour).  Timer below:&lt;br /&gt;
setTimer(allvehiclesaredoomed, 3600000, 0)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AttachElements&amp;diff=45747</id>
		<title>AttachElements</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AttachElements&amp;diff=45747"/>
		<updated>2015-08-19T15:54:09Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function attaches one element to another, so that the first one follows the second whenever it moves. &lt;br /&gt;
&lt;br /&gt;
If an attempt is made to attach two elements that are already attached the opposite way (eg theElement becomes theAttachToElement and vice versa), the 1st attachment order is automatically detached in favor of the 2nd attachment order. For example, if carA was attached to carB, now carB is attached to carA. Also, an element cannot be attached to two separate elements at one time. For example, two cars can be attached to one single car, but one single car cannot be attached to two separate cars. If you attempt to do this, the existing attachment will automatically be dropped in favor of the new attachment. For example, if carA is asked to attached to carB then carC, it is only attached to carC.&lt;br /&gt;
&lt;br /&gt;
This is not compatible with all elements.  The following elements are compatible:&lt;br /&gt;
* [[Marker]]s&lt;br /&gt;
* [[Blip]]s&lt;br /&gt;
* [[Object]]s&lt;br /&gt;
* [[Player]]s&lt;br /&gt;
* [[Vehicle]]s&lt;br /&gt;
* [[Sound]]s&lt;br /&gt;
* [[Colshape]]s&lt;br /&gt;
* [[Camera]]s&lt;br /&gt;
* [[createWeapon|Weapons]]&lt;br /&gt;
&lt;br /&gt;
'''Note:''' The offset coodinates reflect the object space, not the world space. This means that you cannot calculate the exact offsets between two objects by pre-positioning them in the map editor as a reference. Please see [[attachElementsOffsets]] for more details.&lt;br /&gt;
&lt;br /&gt;
'''Note #2:''' Due to a limitation in GTA, unexpected attach rotations may occur if all rotation offsets are non-zero. (i.e. Try to ensure at least one of 'xRotOffset', 'yRotOffset' or 'zRotOffset' is zero)&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool attachElements ( element theElement, element theAttachToElement, [ float xPosOffset, float yPosOffset, float zPosOffset, float xRotOffset, float yRotOffset, float zRotOffset ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[element]]:attach||}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The element to be attached.&lt;br /&gt;
*'''theAttachToElement:''' The element to attach the first to.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''xPosOffset:''' The x offset, if you want the elements to be a certain distance from one another (default 0).&lt;br /&gt;
*'''yPosOffset:''' The y offset (default 0).&lt;br /&gt;
*'''zPosOffset:''' The z offset (default 0).&lt;br /&gt;
*'''xRotOffset:''' The x rotation offset (default 0).&lt;br /&gt;
*'''yRotOffset:''' The y rotation offset (default 0).&lt;br /&gt;
*'''zRotOffset:''' The z rotation offset (default 0).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the attaching process was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 1:''' This example attaches a marker to the player who steals the Mr. Whoopee:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- create the vehicle&lt;br /&gt;
local vehicleMrWhoopee = createVehicle ( 423, 237.472, -54.225, 1.518, 0, 354.488, 0 )&lt;br /&gt;
&lt;br /&gt;
function onMrWhoopeeEnter ( thePlayer, seat, jackedPlayer )&lt;br /&gt;
    outputChatBox ( getPlayerName ( thePlayer ) .. &amp;quot; stole the Whoopee!&amp;quot;, root, 255, 0, 0 )&lt;br /&gt;
    -- create the marker to attach&lt;br /&gt;
    local arrowMarker = createMarker ( 0, 0, 0, &amp;quot;arrow&amp;quot;, .75, 255, 0, 0, 170 )&lt;br /&gt;
    -- attach the marker to the player with a vertical offset of 2 units&lt;br /&gt;
    attachElements ( arrowMarker, thePlayer, 0, 0, 2 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- attach it to an event&lt;br /&gt;
addEventHandler ( &amp;quot;onVehicleEnter&amp;quot;, vehicleMrWhoopee, onMrWhoopeeEnter )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
'''Example 2:''' This function adds a tank on top of a player (for extra defense):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function tankHat ( source, commandName )&lt;br /&gt;
      local x, y, z = getElementPosition ( source ) --Get the players position&lt;br /&gt;
      local tank = createVehicle ( 432, x, y, z + 5 ) --Create a tank&lt;br /&gt;
      attachElements ( tank, source, 0, 0, 5 ) --Attach the tank to the player.&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;hat&amp;quot;, tankHat )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
'''Example 3:''' This function adds a tank on top of a player (for extra defense), clientside.  This means it will be invisible to other players.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function tankHat ( commandName )&lt;br /&gt;
      local x, y, z = getElementPosition ( source ) --Get the players position&lt;br /&gt;
      local tank = createVehicle ( 432, x, y, z + 5 ) --Create a tank&lt;br /&gt;
      attachElements ( tank, source, 0, 0, 5 ) --Attach the tank to the player.&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler( &amp;quot;hat&amp;quot;, tankHat )&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;
{{Element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiCreateBrowser&amp;diff=45746</id>
		<title>GuiCreateBrowser</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCreateBrowser&amp;diff=45746"/>
		<updated>2015-08-19T15:38:30Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client_function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function creates a new CEGUI web [[Element/Browser|browser]] element.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;gui-browser guiCreateBrowser( float x, float y, float width, float height, bool isLocal, bool isTransparent, bool isRelative [ , element parent = nil ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/gui-browser|GuiBrowser]]}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''x, y:''' The browser's position&lt;br /&gt;
*'''width:''' The browser's native width&lt;br /&gt;
*'''height:''' The browser's native height&lt;br /&gt;
*'''isLocal:''' See examples&lt;br /&gt;
*'''isTransparent:''' ''true'' if you want the browser to support transparency, ''false'' otherwise&lt;br /&gt;
*'''isRelative:''' This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''parent:''' This is the parent that the radio button is attached to. If the relative argument is true, sizes and positioning will be made relative to this parent. If the relative argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the [[gui-browser]] element was successfully created, ''false'' otherwise. Returns also ''false'', if the user disabled remote pages and ''isLocal'' was set to ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This examples attached a webbrowser to a CEGUI window, '''not is tested'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--In order to render the browser on the full screen, we need to know the dimensions.&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
--Let's create a new browser in remote mode.&lt;br /&gt;
local window = guiCreateWindow(0, 0, screenWidth, screenHeight, &amp;quot;Webbrowser&amp;quot;, false)&lt;br /&gt;
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)&lt;br /&gt;
&lt;br /&gt;
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.&lt;br /&gt;
-- After this event has been triggered, we will be able to load our URL&lt;br /&gt;
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, theBrowser, &lt;br /&gt;
	function()&lt;br /&gt;
		-- After the browser has been initialized, we can load www.youtube.com&lt;br /&gt;
		loadBrowserURL(source, &amp;quot;http://www.youtube.com&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiCreateBrowser&amp;diff=45745</id>
		<title>GuiCreateBrowser</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCreateBrowser&amp;diff=45745"/>
		<updated>2015-08-19T15:36:49Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client_function}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function creates a new CEGUI web [[Element/Browser|browser]] element.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;gui-browser guiCreateBrowser( float x, float y, float width, float height, bool isLocal, bool isTransparent, bool isRelative [ , element parent = nil ] )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/gui-browser|GuiBrowser]]}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''x, y:''' The browser's position&lt;br /&gt;
*'''width:''' The browser's native width&lt;br /&gt;
*'''height:''' The browser's native height&lt;br /&gt;
*'''isLocal:''' See examples&lt;br /&gt;
*'''isTransparent:''' ''true'' if you want the browser to support transparency, ''false'' otherwise&lt;br /&gt;
*'''isRelative:''' This is whether sizes and positioning are relative. If this is true, then all x,y,width,height floats must be between 0 and 1, representing measures relative to the parent.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''parent:''' This is the parent that the radio button is attached to. If the relative argument is true, sizes and positioning will be made relative to this parent. If the relative argument is false, positioning will be the number of offset pixels from the parent's origin. If no parent is passed, the parent will become the screen - causing positioning and sizing according to screen positioning. &lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the [[gui-browser]] element was successfully created, ''false'' otherwise. Returns also ''false'', if the user disabled remote pages and ''isLocal'' was set to ''false''.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This examples attached a webbrowser to a CEGUI window, '''not is tested'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
--In order to render the browser on the full screen, we need to know the dimensions.&lt;br /&gt;
local screenWidth, screenHeight = guiGetScreenSize()&lt;br /&gt;
&lt;br /&gt;
--Let's create a new browser in remote mode.&lt;br /&gt;
local window = guiCreateWindow(200, 200, screenWidth, screenHeight, &amp;quot;Webbrowser&amp;quot;, false)&lt;br /&gt;
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)&lt;br /&gt;
&lt;br /&gt;
-- The event onClientBrowserCreated will be triggered, after the browser has been initialized.&lt;br /&gt;
-- After this event has been triggered, we will be able to load our URL&lt;br /&gt;
local theBrowser = guiGetBrowser(browser) -- Get the browser element from gui-browser&lt;br /&gt;
addEventHandler(&amp;quot;onClientBrowserCreated&amp;quot;, theBrowser, &lt;br /&gt;
	function()&lt;br /&gt;
		-- After the browser has been initialized, we can load www.youtube.com&lt;br /&gt;
		loadBrowserURL(source, &amp;quot;http://www.youtube.com&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{GUI_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetBrowserSettings&amp;diff=45744</id>
		<title>GetBrowserSettings</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetBrowserSettings&amp;diff=45744"/>
		<updated>2015-08-19T15:35:31Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
{{Needs Example}}&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
This function returns a table containing the browser settings.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table getBrowserSettings ()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Element/Browser|Browser]].getSettings||getBrowserSettings}}&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
A table having the following keys:&lt;br /&gt;
* '''RemoteEnabled''': ''true'' if remote websites are enabled, ''false'' otherwise&lt;br /&gt;
* '''RemoteJavascript''': ''true'' if Javascript is enabled on remote websites, ''false'' otherwise&lt;br /&gt;
* '''PluginsEnabled''': ''true'' if plugins such as Flash, Silverlight (but not Java) are enabled, ''false'' otherwise. This setting is ''false'' by default.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example is '''not tested'''&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local window = guiCreateWindow(200, 200, 1024, 768, &amp;quot;Webbrowser&amp;quot;, false)&lt;br /&gt;
local browser = guiCreateBrowser(0, 0, 800, 600, false, false, false, window)&lt;br /&gt;
&lt;br /&gt;
for k,v in pairs(getBrowserSettings(browser)) do&lt;br /&gt;
 outputChatBox(&amp;quot;['&amp;quot;..tostring(k)..&amp;quot;'] = '&amp;quot;..tostring(v))&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{CEF_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FxAddBlood&amp;diff=45723</id>
		<title>FxAddBlood</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FxAddBlood&amp;diff=45723"/>
		<updated>2015-08-18T12:52:58Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
[[Image:Fxblood.png|thumb|200px|Blood splatter]]&lt;br /&gt;
Creates a blood splatter particle effect.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fxAddBlood ( float posX, float posY, float posZ, float dirX, float dirY, float dirZ, [int count=1, float brightness=1.0] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Effect]].addBlood}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''posX, posY, posZ:''' the world coordinates where the effect originates.&lt;br /&gt;
*'''dirX, dirY, dirZ:''' a direction vector indicating where the blood flies to.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
*'''count:''' the number of flying droplets to create.&lt;br /&gt;
*'''brightness:''' the brightness. Ranges from 0 (almost black) to 1 (normal color).&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates blood effects when a player gets shot.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function BloodonDamage( attacker, weapon, bodypart, loss )&lt;br /&gt;
   if loss &amp;gt; 25 then -- if the player loses more than 25 hp, then...&lt;br /&gt;
      local x, y, z = getElementPosition( source ) -- get player's position for adding blood&lt;br /&gt;
      local randombloodamount = math.random( 1, 3 ) -- random blood amount 1-3&lt;br /&gt;
      fxAddBlood ( x, y, z-2, 0.00000, 0.00000, 0.00000, randombloodamount, 1 )&lt;br /&gt;
      -- this adds blood to player's current position&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientPlayerDamage&amp;quot;, root, BloodonDamage ) -- calls the function when a player loses hp&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;
{{Client Effects functions}}&lt;br /&gt;
[[ru:FxAddBlood]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FxAddWaterHydrant&amp;diff=45722</id>
		<title>FxAddWaterHydrant</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FxAddWaterHydrant&amp;diff=45722"/>
		<updated>2015-08-18T12:49:55Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
[[Image:Fxwaterhydrant.png|thumb|200px|Water hydrant]]&lt;br /&gt;
This function creates a water hydrant particle effect.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool fxAddWaterHydrant ( float posX, float posY, float posZ )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[Effect]].addWaterHydrant}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''posX:''' A float representing the '''x''' position of the hydrant &lt;br /&gt;
* '''posY:''' A float representing the '''y''' position of the hydrant &lt;br /&gt;
* '''posZ:''' A float representing the '''z''' position of the hydrant&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a true if the operation was successful, false otherwise. &lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example will create 20 water hydrant effects around the players position when they use the command: hydrantmania.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function createHydrants()&lt;br /&gt;
	local x, y, z = getElementPosition(localPlayer) -- Get your location.&lt;br /&gt;
	for i=0, 20 do -- 20 Hydrants.&lt;br /&gt;
		fxAddWaterHydrant(x + math.random(-5,5), y + math.random(-5,5), z) -- Using math.random, and your current location 20 water hydrants are created.&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;hydrantmania&amp;quot;, createHydrants)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client Effects functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxSetPixelColor&amp;diff=45721</id>
		<title>DxSetPixelColor</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxSetPixelColor&amp;diff=45721"/>
		<updated>2015-08-18T12:47:09Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function sets the color of a single pixel for [[Texture_pixels|pixels]] contained in a string. It only works with ''''plain'''' format pixels.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dxSetPixelColor ( string pixels, int x, int y, int r, int g, int b [, int a = 255 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''pixels :''' The pixels to use&lt;br /&gt;
*'''x:''' The X coordinate for the pixel&lt;br /&gt;
*'''y:''' The Y coordinate for the pixel&lt;br /&gt;
*'''r:''' The red channel for the color (0-255)&lt;br /&gt;
*'''g:''' The green channel for the color (0-255)&lt;br /&gt;
*'''b:''' The blue channel for the color (0-255)&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''a:''' The alpha channel for the color (0-255)&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
Returns true if successful, or ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example creates a 64x64 texture with random pixel colors, and draw it on the screen.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler (&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, &lt;br /&gt;
    function () &lt;br /&gt;
         texture = dxCreateTexture (64, 64)&lt;br /&gt;
         local pixels = dxGetTexturePixels (texture)&lt;br /&gt;
         for i=0,63 do&lt;br /&gt;
             for j=0,63 do&lt;br /&gt;
                 dxSetPixelColor (pixels, j, i, math.random (255), math.random (255), math.random (255), 255)&lt;br /&gt;
             end;&lt;br /&gt;
         end;&lt;br /&gt;
         dxSetTexturePixels (texture, pixels)&lt;br /&gt;
    end)&lt;br /&gt;
&lt;br /&gt;
addEventHandler (&amp;quot;onClientRender&amp;quot;, root,&lt;br /&gt;
    function ()&lt;br /&gt;
         dxDrawImage (300, 300, 64, 64, texture)&lt;br /&gt;
    end)&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;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGetTextWidth&amp;diff=45720</id>
		<title>DxGetTextWidth</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGetTextWidth&amp;diff=45720"/>
		<updated>2015-08-18T12:41:14Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the theoretical width of a certain piece of text, if it were to be drawn using [[dxDrawText]].&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
float dxGetTextWidth ( string text, [float scale=1, mixed font=&amp;quot;default&amp;quot;, bool bColorCoded=false] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{New feature/item|3.0141|1.4.1|6942|{{OOP|This syntax requires you to ignore the font argument above| [[Element/DX font|font]]:getTextWidth}}}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''text:''' A string representing the text for which you wish to retrieve with width for.&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text.&lt;br /&gt;
* '''font:''' Either a custom [[DX font]] element or the name of a built-in dx font:&lt;br /&gt;
{{DxFonts}}&lt;br /&gt;
* '''bColorCoded:''' Should we exclude color codes from the width? (false will include the hex in the length)&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns the float of the width of the text. &lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This will show you the width of a message in a normal chatbox sent by a player&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function dxwidth(msg)&lt;br /&gt;
    chatbox = getChatboxLayout()&lt;br /&gt;
    local length = dxGetTextWidth(msg,chatbox[&amp;quot;chat_scale&amp;quot;][1])&lt;br /&gt;
    outputChatBox(tostring(length))&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientChatMessage&amp;quot;,root,dxwidth)&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;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxGetFontHeight&amp;diff=45719</id>
		<title>DxGetFontHeight</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxGetFontHeight&amp;diff=45719"/>
		<updated>2015-08-18T12:40:19Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function retrieves the theoretical height of a certain piece of text, if it were to be drawn using [[dxDrawText]]. &lt;br /&gt;
{{Note|The returned height will be in logical units which are 1.75 times the actual pixel height.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int dxGetFontHeight ( [float scale=1, mixed font=&amp;quot;default&amp;quot;] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{New feature/item|3.0141|1.4.1|6942|{{OOP|This syntax requires you to ignore the font argument above| [[Element/DX font|font]]:getHeight}}}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
''None''&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''scale:''' The size of the text.&lt;br /&gt;
* '''font:''' Either a custom [[DX font]] element or the name of a built-in dx font:&lt;br /&gt;
{{DxFonts}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an integer of the height of the text.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The following example will draw two lines of text one above the other.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&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;
screenWidth, screenHeight = guiGetScreenSize() -- Get the screen resolution&lt;br /&gt;
scale = 2  -- The scale of both texts&lt;br /&gt;
&lt;br /&gt;
-- We add an event handler to keep drawing the text &lt;br /&gt;
addEventHandler(&amp;quot;onClientRender&amp;quot;,root,function()&lt;br /&gt;
&lt;br /&gt;
   -- Draw the first text 400 pixels from the top and left of the screen&lt;br /&gt;
   dxDrawText(&amp;quot;Hello!&amp;quot;, 400, 400, screenWidth,screenHeight,tocolor(255,255,255,255),scale,&amp;quot;pricedown&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
   -- Draw the second text above the first one.&lt;br /&gt;
   -- The variable &amp;quot;offset&amp;quot; will return the height of the first text, so we can position the second text above the first one. &lt;br /&gt;
   -- If we changed the scale, the second text would still be above the first one, since we calculated the height of the font. &lt;br /&gt;
   offset = dxGetFontHeight(scale,&amp;quot;pricedown&amp;quot;)&lt;br /&gt;
   dxDrawText(&amp;quot;Hello!&amp;quot;, 400, 400 - offset, screenWidth, screenHeight,tocolor(255,255,255,255),scale,&amp;quot;pricedown&amp;quot;)&lt;br /&gt;
end)&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;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawLine3D&amp;diff=45718</id>
		<title>DxDrawLine3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawLine3D&amp;diff=45718"/>
		<updated>2015-08-18T12:36:35Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
This function draws a 3D line between two points in the 3D world - rendered for '''one''' frame.  This should be used in conjunction with [[onClientRender]] in order to display continuously.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dxDrawLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, int color[, int width, bool postGUI ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
* '''startX:''' The start X position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''startY:''' The start Y position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''startZ:''' The start Z position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''endX:''' The end X position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''endY:''' The end Y position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''endZ:''' The end Z position of the 3D line, representing a coordinate in the GTA world.&lt;br /&gt;
* '''color:''' An integer of the hex color, produced using [[tocolor]] or 0xAARRGGBB (AA = alpha, RR = red, GG = green, BB = blue).&lt;br /&gt;
&lt;br /&gt;
==Optional Arguments==&lt;br /&gt;
{{OptionalArg}}&lt;br /&gt;
* '''width:''' The width/thickness of the line&lt;br /&gt;
* '''postGUI:''' A bool representing whether the line should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a ''true'' if the operation was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This is a small example of creating 3D Line / &amp;quot;Rope&amp;quot; between vehicle and player.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function makeLineAppear()&lt;br /&gt;
	testVehicle = createVehicle ( 411, 0, 0, 5 ) -- Create our test vehicle.&lt;br /&gt;
	addEventHandler(&amp;quot;onClientRender&amp;quot;, root, createLine)        -- onClientRender keeps the 3D Line visible.&lt;br /&gt;
end&lt;br /&gt;
function createLine ( )&lt;br /&gt;
	x1, y1, z1 = getElementPosition ( testVehicle )                       -- Get test vehicles position.&lt;br /&gt;
	x2, y2, z2 = getElementPosition ( localPlayer )                  -- Get local players position.&lt;br /&gt;
	dxDrawLine3D ( x1, y1, z1, x2, y2, z2, tocolor ( 0, 255, 0, 230 ), 2) -- Create 3D Line between test vehicle and local player.&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;test&amp;quot;, makeLineAppear)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=DxDrawImage&amp;diff=45717</id>
		<title>DxDrawImage</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=DxDrawImage&amp;diff=45717"/>
		<updated>2015-08-18T12:33:44Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}} &lt;br /&gt;
&lt;br /&gt;
Draws an image on the screen for a single frame. In order for the image to stay visible continuously, you need to call this function with the same parameters on each frame update (see [[onClientRender]]).&amp;lt;br/&amp;gt;&lt;br /&gt;
Image files should ideally have dimensions that are a power of two, to prevent possible blurring.&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Power of two: 2px, 4px, 8px, 16px, 32px, 64px, 128px, 256px, 512px, 1024px...&amp;lt;/b&amp;gt;&lt;br /&gt;
{{Note|To help prevent edge artifacts when drawing textures, set '''textureEdge''' to '''&amp;quot;clamp&amp;quot;''' when calling [[dxCreateTexture]]}}&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool dxDrawImage ( float posX, float posY, float width, float height, mixed image,&lt;br /&gt;
                 [ float rotation = 0, float rotationCenterOffsetX = 0, float rotationCenterOffsetY = 0,&lt;br /&gt;
                   int color = tocolor(255,255,255,255), bool postGUI = false ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''posX:''' the absolute X coordinate of the top left corner of the image&lt;br /&gt;
*'''posY:''' the absolute Y coordinate of the top left corner of the image&lt;br /&gt;
*'''width:''' the absolute width of the image&lt;br /&gt;
*'''height:''' the absolute height of the image&lt;br /&gt;
*'''image:''' Either a [[material]] element or a [[filepath]] of the image which is going to be drawn. (.dds images are also supported). Image files should ideally have dimensions that are a power of two, to prevent possible blurring.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''rotation:''' the rotation, in degrees for the image.&lt;br /&gt;
*'''rotationCenterOffsetX:''' the absolute X offset from the image center for which to rotate the image from.&lt;br /&gt;
*'''rotationCenterOffsetY:''' the absolute Y offset from the image center for which to rotate the image from.&lt;br /&gt;
*'''color:''' Tints the image with a value produced by [[tocolor]] or hexadecimal number in format: 0xAARRGGBB (RR = red, GG = green, BB = blue, AA = alpha).&lt;br /&gt;
*'''postGUI:''' A bool representing whether the image should be drawn on top of or behind any ingame GUI (rendered by CEGUI).&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
Example of a pendulum swinging from the top of the screen, made using dxDrawImage.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local screenWidth,screenHeight = guiGetScreenSize()  -- Get screen resolution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function renderDisplay ( )&lt;br /&gt;
	local seconds = getTickCount() / 1000&lt;br /&gt;
	local angle = math.sin(seconds) * 80&lt;br /&gt;
	-- This will draw the graphic file 'arrow.png' at the top middle of the screen&lt;br /&gt;
	-- using the size of 100 pixels wide, and 240 pixels high.&lt;br /&gt;
	-- The center of rotation is at the top of the image.&lt;br /&gt;
	dxDrawImage ( screenWidth/2 - 50, 0, 100, 240, 'arrow.png', angle, 0, -120 )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function HandleTheRendering ( )&lt;br /&gt;
	addEventHandler(&amp;quot;onClientRender&amp;quot;, root, renderDisplay)  -- Keep everything visible with onClientRender.&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;,resourceRoot, HandleTheRendering)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Drawing_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=IsElementWithinColShape&amp;diff=45716</id>
		<title>IsElementWithinColShape</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=IsElementWithinColShape&amp;diff=45716"/>
		<updated>2015-08-18T12:27:07Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to determine if an element is within a collision shape. Please note that for legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move. Please also note that before 1.0.3, this did not function correctly when moving a colshape.&lt;br /&gt;
&lt;br /&gt;
Please note that this function doesn't verify whether element is in the same dimension and interior, additional checks could be implemented manually if they are needed.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool isElementWithinColShape ( element theElement, colshape theShape )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[element]]:isWithinColShape}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''theElement:''' The [[element]] you're checking.&lt;br /&gt;
*'''theShape:''' The [[colshape]] you're checking&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the element is within the colshape, ''false'' otherwise&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This small script is an example of detecting if a player is within a certain defined colshape. This could serve as a base to perform many functions, rather than just an output.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local circlearea = createColCircle ( 0, 0, 10 )&lt;br /&gt;
&lt;br /&gt;
function ColShapeHit ( thePlayer, matchingDimension )&lt;br /&gt;
	local detection = isElementWithinColShape ( thePlayer, circlearea )&lt;br /&gt;
	--A variable called 'detection' stores the result of asking if the player&lt;br /&gt;
	--who entered a colshape is within the specific colshape called 'circlearea'.&lt;br /&gt;
	--The result is either true or false.&lt;br /&gt;
	detection = detection and getElementDimension( thePlayer ) == getElementDimension( circlearea )&lt;br /&gt;
	--Let's additionally check element dimensions.&lt;br /&gt;
	if detection then&lt;br /&gt;
		outputChatBox ( getPlayerName(thePlayer)..&amp;quot; is in the 'circle area' col shape&amp;quot; )&lt;br /&gt;
	end&lt;br /&gt;
	--if detection was true then the player is in the col shape. Output a&lt;br /&gt;
	--message to confirm this&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onColShapeHit&amp;quot;, root, ColShapeHit )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{element functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=RemovePedClothes&amp;diff=45715</id>
		<title>RemovePedClothes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=RemovePedClothes&amp;diff=45715"/>
		<updated>2015-08-18T12:18:43Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function is used to remove the current clothes of a certain type on a [[ped]]. It will remove them if the clothesTexture and clothesModel aren't specified, or if they match the current clothes on that slot.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool removePedClothes ( ped thePed, int clothesType, [ string clothesTexture, string clothesModel ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[ped]]:removeClothes}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed''': The [[ped]] you want to remove clothes from.&lt;br /&gt;
*'''clothesType''': the clothes slot/type to remove. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''clothesTexture''': (Server only) A string determining the clothes texture that will be removed. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesModel''': (Server only) A string determining the clothes model that will be removed. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function returns ''true'' if the clothes were successfully removed from the ped, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function addHelmetOnEnter ( vehicleEntered, seat, jacked )&lt;br /&gt;
    if getElementModel ( vehicleEntered ) == 522 then      -- if it's a nrg&lt;br /&gt;
        addPedClothes ( source, &amp;quot;moto&amp;quot;, &amp;quot;moto&amp;quot;, 16 )       -- add the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, addHelmetOnEnter )&lt;br /&gt;
&lt;br /&gt;
function removeHelmetOnExit ( vehicleExited, seat, jacked )&lt;br /&gt;
    if getElementModel ( vehicleExited ) == 522 then       -- if it's a nrg&lt;br /&gt;
        removePedClothes ( source, 16, &amp;quot;moto&amp;quot;, &amp;quot;moto&amp;quot; )    -- remove that helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, removeHelmetOnExit )&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;
{{Ped functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetBodyPartName&amp;diff=45714</id>
		<title>GetBodyPartName</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetBodyPartName&amp;diff=45714"/>
		<updated>2015-08-18T12:16:39Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function is used to get the name of a body part on a player.&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 getBodyPartName ( int bodyPartID )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''bodyPartID''': An integer representing the body part ID you wish to retrieve the name of.&lt;br /&gt;
{{BodyParts}}&lt;br /&gt;
&lt;br /&gt;
==Returns==&lt;br /&gt;
This function returns a string containing the body part name if the ID is valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example prints the killer and body part to the chat on the wasted/kill event.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function deathMessageOnWasted ( ammo, attacker, weapon, bodypart )&lt;br /&gt;
  if ( attacker ) then                                    -- if we have an attacker&lt;br /&gt;
    if ( getElementType ( attacker ) == &amp;quot;player&amp;quot; ) then   -- make sure the element that killed him was a player&lt;br /&gt;
      tempString = getPlayerName ( attacker ) .. &amp;quot; killed &amp;quot; .. getPlayerName ( source ) .. &amp;quot; (&amp;quot; .. getWeaponNameFromID ( weapon ) .. &amp;quot;)&amp;quot;&lt;br /&gt;
      if ( bodypart == 9 ) then -- if he was shot in the head&lt;br /&gt;
        tempString = tempString .. &amp;quot; (HEADSHOT!)&amp;quot;&lt;br /&gt;
      else&lt;br /&gt;
        tempString = tempString .. &amp;quot; (&amp;quot; .. getBodyPartName ( bodypart ) .. &amp;quot;)&amp;quot;&lt;br /&gt;
      end&lt;br /&gt;
      outputChatBox ( tempString )&lt;br /&gt;
    else&lt;br /&gt;
      outputChatBox ( getPlayerName ( source ) .. &amp;quot; died. (&amp;quot; .. getWeaponNameFromID ( weapon ) .. &amp;quot;) (&amp;quot; .. getBodyPartName ( bodypart ) .. &amp;quot;)&amp;quot; )&lt;br /&gt;
    end&lt;br /&gt;
  else&lt;br /&gt;
    outputChatBox ( getPlayerName ( source ) .. &amp;quot; died. (&amp;quot; .. getWeaponNameFromID ( weapon ) .. &amp;quot;) (&amp;quot; .. getBodyPartName ( bodypart ) .. &amp;quot;)&amp;quot; )&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerWasted&amp;quot;, root, deathMessageOnWasted )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Clothes and body functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddPedClothes&amp;diff=45713</id>
		<title>AddPedClothes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddPedClothes&amp;diff=45713"/>
		<updated>2015-08-18T12:15:46Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Note|This function only works with peds using CJ skin (ID 0).}}&lt;br /&gt;
This function is used to set the current clothes on a [[ped]]. &lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addPedClothes ( ped thePed, string clothesTexture, string clothesModel, int clothesType )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[ped]]:addClothes||getPedClothes}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed''': The [[ped]] whose clothes you want to change.&lt;br /&gt;
*'''clothesTexture''': A string determining the clothes texture that will be added. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesModel''': A string determining the clothes model that will be added. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesType''': A integer representing the clothes slot/type the clothes should be added to. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns ''true'' if the clothes were successfully added to the ped, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    if getElementModel ( theVehicle ) == 522 then         -- if it's an nrg&lt;br /&gt;
        addPedClothes ( source, &amp;quot;moto&amp;quot;, &amp;quot;moto&amp;quot;, 16 )   -- add the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, root, onEnterVehicle )&lt;br /&gt;
&lt;br /&gt;
function onExitVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    if getElementModel ( theVehicle ) == 522 then      -- if it's an nrg&lt;br /&gt;
        removePedClothes ( source, 16 )              -- remove the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, onExitVehicle )&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;
{{Ped functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=AddPedClothes&amp;diff=45712</id>
		<title>AddPedClothes</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=AddPedClothes&amp;diff=45712"/>
		<updated>2015-08-18T12:15:27Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
{{Note|This function only works with peds using CJ skin (ID 0).}}&lt;br /&gt;
This function is used to set the current clothes on a [[ped]]. &lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool addPedClothes ( ped thePed, string clothesTexture, string clothesModel, int clothesType )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[ped]]:addClothes||getPedClothes}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''thePed''': The [[ped]] whose clothes you want to change.&lt;br /&gt;
*'''clothesTexture''': A string determining the clothes texture that will be added. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesModel''': A string determining the clothes model that will be added. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
*'''clothesType''': A integer representing the clothes slot/type the clothes should be added to. See the [[CJ Clothes|clothes catalog]].&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
This function returns ''true'' if the clothes were successfully added to the ped, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example adds a 'moto' helmet to a player when he gets on a nrg bike, and removes it when he gets off.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onEnterVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    if getElementModel ( theVehicle ) == 522 then         -- if it's an nrg&lt;br /&gt;
        addPedClothes ( source, &amp;quot;moto&amp;quot;, &amp;quot;moto&amp;quot;, 16 )   -- add the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleEnter&amp;quot;, getRootElement(), onEnterVehicle )&lt;br /&gt;
&lt;br /&gt;
function onExitVehicle ( theVehicle, seat, jacked )&lt;br /&gt;
    if getElementModel ( theVehicle ) == 522 then      -- if it's an nrg&lt;br /&gt;
        removePedClothes ( source, 16 )              -- remove the helmet&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerVehicleExit&amp;quot;, root, onExitVehicle )&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;
{{Ped functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraShakeLevel&amp;diff=45711</id>
		<title>SetCameraShakeLevel</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraShakeLevel&amp;diff=45711"/>
		<updated>2015-08-18T12:13:50Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
{{New feature/item|3.0150|1.5|7343|&lt;br /&gt;
This function sets the camera shake level (as seen on the ''Are you going to San Fierro?'' singleplayer mission).}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setCameraShakeLevel ( int shakeLevel )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required arguments===&lt;br /&gt;
*'''shakeLevel''': an integer between 0 and 255, which represents the camera shake intensity level.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the camera shake level was changed, ''false'' if the required argument is incorrect or missing.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example adds a ''/camshake'' command which allows any player to manually change its camera shake level.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addCommandHandler( &amp;quot;camshake&amp;quot;,&lt;br /&gt;
    function( _, level )&lt;br /&gt;
        local level = math.floor( level )&lt;br /&gt;
        if level and level &amp;gt;=0 and level &amp;lt;= 255 then&lt;br /&gt;
            setCameraShakeLevel( level )&lt;br /&gt;
            outputChatBox( &amp;quot;Camera shake level updated to &amp;quot; .. level .. &amp;quot;.&amp;quot; )&lt;br /&gt;
        else&lt;br /&gt;
            outputChatBox( &amp;quot;Camera shake level must be between 0 and 255.&amp;quot; )&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Client_camera_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraViewMode&amp;diff=45710</id>
		<title>SetCameraViewMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraViewMode&amp;diff=45710"/>
		<updated>2015-08-18T12:12:45Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function allows you to set the camera's view mode if you are inside a [[vehicle]]. This indicates at what distance the camera will follow the player.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setCameraViewMode ( int viewMode )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''viewMode''': The view mode you wish to use&lt;br /&gt;
{{Camera view modes}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the view was set correctly, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example sets the camera to bumper view when the local player enters any vehicle.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerVehicleEnter&amp;quot;, localPlayer, function()&lt;br /&gt;
  setCameraViewMode(0)&lt;br /&gt;
end)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client camera functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraTarget&amp;diff=45709</id>
		<title>SetCameraTarget</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraTarget&amp;diff=45709"/>
		<updated>2015-08-18T12:12:04Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function allows you to set a player's camera to follow other elements instead. Currently supported element type is:&lt;br /&gt;
*[[Player]]s&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&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 setCameraTarget ( player thePlayer [, player target = nil ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:setCameraTarget|cameraTarget|getCameraTarget}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player whose camera you wish to modify.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''target:''' The player who you want the camera to follow. If none is specified, the camera will target the player.&lt;br /&gt;
'''Note:''' setCameraTarget will behave strangely if the target you want the camera to follow is inside a vehicle that has hydraulics (upgrade id: 1087) added server sided and if the target is not you.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client 1&amp;quot; class=&amp;quot;client&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 setCameraTarget ( player target )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''target:''' The player who you want the local camera to follow.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{New feature/item|3.0132|1.3.1|5212|&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client 2&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This syntax mantains the player targeted by the camera, but makes the camera look at the specified coordinates. It has no effect when the camera doesn't have a target.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setCameraTarget ( float targetX, float targetY, float targetZ )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
*'''targetX, targetY, targetZ:''' The target position that you want the local camera to look at.&lt;br /&gt;
&amp;lt;/section&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the function was successful, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This is an example of how one could implement a spectator function. Using the left and right arrow keys you can view other players. Note that this code isn't complete as it doesn't take into account joining or quitting players.&lt;br /&gt;
&amp;lt;section class=&amp;quot;client&amp;quot; name=&amp;quot;Client script&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;
g_Players = getElementsByType(&amp;quot;player&amp;quot;)        -- get a list of all players in the server&lt;br /&gt;
for i,aPlayer in ipairs(g_Players) do          -- find out what index the local player has in the list&lt;br /&gt;
    if aPlayer == localPlayer then&lt;br /&gt;
        g_CurrentSpectated = i&lt;br /&gt;
        break&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function spectatePrevious()                    -- decrement the spectate index and spectate the corresponding player&lt;br /&gt;
     if g_CurrentSpectated == 1 then&lt;br /&gt;
         g_CurrentSpectated = #g_Players&lt;br /&gt;
     else&lt;br /&gt;
         g_CurrentSpectated = g_CurrentSpectated - 1&lt;br /&gt;
     end&lt;br /&gt;
    setCameraTarget(g_Players[g_CurrentSpectated])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function spectateNext()                        -- increment the spectate index and spectate the corresponding player&lt;br /&gt;
     if g_CurrentSpectated == #g_Players then&lt;br /&gt;
         g_CurrentSpectated = 1&lt;br /&gt;
     else&lt;br /&gt;
         g_CurrentSpectated = g_CurrentSpectated + 1&lt;br /&gt;
     end&lt;br /&gt;
    setCameraTarget(g_Players[g_CurrentSpectated])&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Bind above functions to arrow keys&lt;br /&gt;
bindKey(&amp;quot;arrow_l&amp;quot;, &amp;quot;down&amp;quot;, spectatePrevious)&lt;br /&gt;
bindKey(&amp;quot;arrow_r&amp;quot;, &amp;quot;down&amp;quot;, spectateNext)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
{{Issues|&lt;br /&gt;
{{Issue|7594|setCameraTarget on a player inside a vehicle with hydraulics bugs camera}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraMatrix&amp;diff=45708</id>
		<title>SetCameraMatrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraMatrix&amp;diff=45708"/>
		<updated>2015-08-18T12:11:21Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Server client function}}&lt;br /&gt;
This function sets the camera's position and direction. The first three arguments are the point at which the camera lies, the last three are the point the camera faces (or the point it &amp;quot;looks at&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
'''Note:''' Calling this function takes the camera's focus away from the player and sets the camera in a fixed position and rotation. The camera's focus can be brought back to the player using the [[setCameraTarget]] function.&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&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 setCameraMatrix ( player thePlayer, float positionX, float positionY, float positionZ [, float lookAtX, float lookAtY, float lookAtZ, float roll = 0, float fov = 70 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:setCameraMatrix|cameraMatrix|getCameraMatrix}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' The player whose camera is to be changed.&lt;br /&gt;
*'''positionX:''' The x coordinate of the camera's position.&lt;br /&gt;
*'''positionY:''' The y coordinate of the camera's position.&lt;br /&gt;
*'''positionZ:''' The z coordinate of the camera's position.&lt;br /&gt;
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''lookAtX:''' The x coordinate of the point the camera faces.&lt;br /&gt;
*'''lookAtY:''' The y coordinate of the point the camera faces.&lt;br /&gt;
*'''lookAtZ:''' The z coordinate of the point the camera faces.&lt;br /&gt;
*'''roll:''' The camera roll angle, -180 to 180. A value of 0 means the camera sits straight, positive values will turn it counter-clockwise and negative values will turn it clockwise. -180 or 180 means the camera is upside down.&lt;br /&gt;
*'''fov:''' the field of view angle, 0 to 180. The higher this value is, the more you will be able to see what is to your sides.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&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 setCameraMatrix ( float positionX, float positionY, float positionZ [, float lookAtX, float lookAtY, float lookAtZ, float roll = 0, float fov = 70 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP|This is under the static class '''Camera'''|Camera.setMatrix|matrix|getCameraMatrix}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''positionX:''' The x coordinate of the camera's position.&lt;br /&gt;
*'''positionY:''' The y coordinate of the camera's position.&lt;br /&gt;
*'''positionZ:''' The z coordinate of the camera's position.&lt;br /&gt;
*'''{{New feature/item|3.0141|1.4.1|7005|Instead of six coordinates, or two vectors, a Matrix can be supplied.}}'''&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
*'''lookAtX:''' The x coordinate of the point the camera faces.&lt;br /&gt;
*'''lookAtY:''' The y coordinate of the point the camera faces.&lt;br /&gt;
*'''lookAtZ:''' The z coordinate of the point the camera faces.&lt;br /&gt;
*'''roll:''' The camera roll angle, -180 to 180. A value of 0 means the camera sits straight, positive values will turn it counter-clockwise and negative values will turn it clockwise. -180 or 180 means the camera is upside down.&lt;br /&gt;
*'''fov:''' the field of view angle, 0 to 180. The higher this value is, the more you will be able to see what is to your sides.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the arguments are valid, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This code fixates the camera onto the Vinewood sign in Los Santos for any player that joins the server:&lt;br /&gt;
&amp;lt;section class=&amp;quot;server&amp;quot; name=&amp;quot;Server script&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;
function setCameraOnPlayerJoin()&lt;br /&gt;
     -- slowly fade the camera in to make the screen visible&lt;br /&gt;
     fadeCamera(source, true, 5)&lt;br /&gt;
     -- set the player's camera to a fixed position, looking at a fixed point&lt;br /&gt;
     setCameraMatrix(source, 1468.8785400391, -919.25317382813, 100.153465271, 1468.388671875, -918.42474365234, 99.881813049316)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onPlayerJoin&amp;quot;, root, setCameraOnPlayerJoin)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Camera functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetCameraClip&amp;diff=45707</id>
		<title>SetCameraClip</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetCameraClip&amp;diff=45707"/>
		<updated>2015-08-18T12:10:29Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Client function}} &lt;br /&gt;
__NOTOC__ &lt;br /&gt;
This function sets if the camera will &amp;quot;collide&amp;quot; with any objects or vehicles in its way. This means that if object clip is enabled an object is in the way of where the camera actually wants to be, the camera will try to be in front of it. This function can disable that.&lt;br /&gt;
&lt;br /&gt;
'''Note:''' This function doesn't fix the issue of camera clip not working on objects out of world bounds.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool setCameraClip ( [ bool objects = true, bool vehicles = true ] ) &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[Camera]].setClip||getCameraClip}}&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
*'''objects:''' Sets if you want the camera to clip on objects.&lt;br /&gt;
*'''vehicles:''' Sets if you want the camera to clip on vehicles.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Always returns ''true''.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This function enables it to look though cars&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function enableCameraThoughCars ()&lt;br /&gt;
  setCameraClip (true,false)&lt;br /&gt;
  outputChatBox (&amp;quot;Your camera can see the vehicle interior now!&amp;quot;,255,0,0,false)&lt;br /&gt;
end&lt;br /&gt;
addEventHandler (&amp;quot;onClientResourceStart&amp;quot;,resourceRoot,enableCameraThoughCars)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client camera functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetCameraViewMode&amp;diff=45706</id>
		<title>GetCameraViewMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetCameraViewMode&amp;diff=45706"/>
		<updated>2015-08-18T12:08:41Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function allows you to get the camera's view mode. This indicates at what distance the camera will follow the player.&lt;br /&gt;
*'''Note:''' It currently only returns vehicle view modes&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int getCameraViewMode (  )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns an [[int]] indicating the current camera view mode. Their meanings can be seen below.&lt;br /&gt;
&lt;br /&gt;
{{Camera view modes}}&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
This example tells the player their current camera view when they change it&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerSpawn ( theSpawnpoint )&lt;br /&gt;
    currentCam(&amp;quot;fire&amp;quot;) -- start a repeating check&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientPlayerSpawn&amp;quot;, root, onPlayerSpawn )&lt;br /&gt;
&lt;br /&gt;
function currentCam(key)&lt;br /&gt;
   if (getControlState(key)) then&lt;br /&gt;
      outputChatBox(&amp;quot;Your current cam view is: &amp;quot;..getCameraViewMode()..&amp;quot;.&amp;quot;)&lt;br /&gt;
   end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client camera functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=FadeCamera&amp;diff=45705</id>
		<title>FadeCamera</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=FadeCamera&amp;diff=45705"/>
		<updated>2015-08-18T12:06:56Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function will fade a player's camera to a color or back to normal over a specified time period. This will also affect the sound volume for the player (50% faded = 50% volume, full fade = no sound). For clientside scripts you can perform 2 fade ins or fade outs in a row, but for serverside scripts you must use one then the other.&lt;br /&gt;
&lt;br /&gt;
''Note: The speed of the effect depends directly on the current gamespeed.''&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&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 fadeCamera ( player thePlayer, bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||[[player]]:fadeCamera}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''thePlayer:''' The player whose camera you wish to fade.&lt;br /&gt;
* '''fadeIn:''' Should the camera be faded in or out? Pass ''true'' to fade the camera in, ''false'' to fade it out to a color.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''timeToFade:''' The number of seconds it should take to fade. Any number less than 1 makes the fade instant.&lt;br /&gt;
* '''red:''' The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''green:''' The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''blue:''' The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&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 fadeCamera ( bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{OOP||Camera.fade}}&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''fadeIn:''' Should the camera be faded in our out? Pass ''true'' to fade the camera in, ''false'' to fade it out to a color.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments===&lt;br /&gt;
* '''timeToFade:''' The number of seconds it should take to fade. Any number less than 1 makes the fade instant.&lt;br /&gt;
* '''red:''' The amount of red in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''green:''' The amount of green in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
* '''blue:''' The amount of blue in the color that the camera fades out to (0 - 255). Not required for fading in.&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the camera was faded successfully, ''false'' if invalid arguments were passed to the function.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server example&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
When a player gets damaged, place a quick fade-to-red effect on his screen.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function addRednessOnDamage ( )&lt;br /&gt;
      fadeCamera ( source, false, 1.0, 255, 0, 0 )         -- fade the player's camera to red over a period of 1 second&lt;br /&gt;
      setTimer ( fadeCameraDelayed, 500, 1, source )   -- don't let it go to opaque red, interrupt it after half a second and fade back to normal&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerDamage&amp;quot;, root, addRednessOnDamage )&lt;br /&gt;
&lt;br /&gt;
function fadeCameraDelayed(player) -- This function prevents debug warnings when the player disconnects while the timer is running.&lt;br /&gt;
      if (isElement(player)) then&lt;br /&gt;
            fadeCamera(player, true, 0.5)&lt;br /&gt;
      end&lt;br /&gt;
end&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;
{{Camera_functions}}&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=StopSound&amp;diff=45704</id>
		<title>StopSound</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=StopSound&amp;diff=45704"/>
		<updated>2015-08-18T11:56:10Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Stops the sound playback for specified [[sound]] [[element]]. The sound element is also destroyed.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool stopSound ( element theSound )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[sound]]:stop}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theSound:''' the [[sound]] [[element]] you want to stop playing.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the sound was successfully stopped, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function startMySound()&lt;br /&gt;
    sound = playSound( &amp;quot;sound.mp3&amp;quot;, true )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler( &amp;quot;onClientResourceStart&amp;quot;, resourceRoot, startMySound )&lt;br /&gt;
&lt;br /&gt;
function stopMySound()&lt;br /&gt;
    stopSound( sound )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler ( &amp;quot;stopsound&amp;quot;, stopMySound ) --using the command 'stopsound' will stop the sound&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_audio_functions}}&lt;br /&gt;
[[AR:stopSound]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=SetSoundVolume&amp;diff=45703</id>
		<title>SetSoundVolume</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=SetSoundVolume&amp;diff=45703"/>
		<updated>2015-08-18T11:55:24Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
This function is used to change the volume level of the specified [[sound]] [[element]].&lt;br /&gt;
Use a player element to control a players voice with this function.&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool setSoundVolume ( element theSound, float volume )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[sound]]:setVolume|volume|getSoundVolume}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theSound:''' The [[sound]] [[element]] which volume you want to modify.&lt;br /&gt;
*'''volume:''' A [[float]]ing point number representing the desired volume level. Range is from '''0.0''' to '''1.0'''&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the [[sound]] [[element]] volume was successfully changed, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function wasted (killer, weapon, bodypart)&lt;br /&gt;
        local sound = playSound(&amp;quot;sounds/wasted.mp3&amp;quot;) --Play wasted.mp3 from the sounds folder&lt;br /&gt;
        setSoundVolume(sound, 0.5) -- set the sound volume to 50%&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
addEventHandler(&amp;quot;onClientPlayerWasted&amp;quot;, localPlayer, wasted) --add the event handler &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Changelog==&lt;br /&gt;
{{ChangelogHeader}}&lt;br /&gt;
{{ChangelogItem|1.3.2|Added player element for voice control}}&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Client_audio_functions}}&lt;br /&gt;
[[AR:setSoundVolume]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PlaySoundFrontEnd&amp;diff=45702</id>
		<title>PlaySoundFrontEnd</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PlaySoundFrontEnd&amp;diff=45702"/>
		<updated>2015-08-18T11:52:56Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Server client function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function plays a frontend sound for the specified player.&lt;br /&gt;
{{Note|These sounds can be disabled with [[setWorldSoundEnabled]] so if these sounds stop working you should check if you're disabling the sounds.}}&lt;br /&gt;
&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&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 playSoundFrontEnd ( player thePlayer, int sound )   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''thePlayer:''' the [[player]] you want the sound to play for.&lt;br /&gt;
*'''sound:''' a whole [[int]] specifying the sound id to play. Valid values are:&lt;br /&gt;
{{Sounds}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;Client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;false&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
bool playSoundFrontEnd ( int sound )   &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[Sound]].playFrontEnd}}}}&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''sound:''' a whole [[int]] specifying the sound id to play. Valid values are:&lt;br /&gt;
{{Sounds}}&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns ''true'' if the sound was successfully played, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example plays a sound when a player spawns.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onPlayerSpawn ( theSpawnpoint, theTeam )&lt;br /&gt;
    playSoundFrontEnd ( source, 16 )&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onPlayerSpawn&amp;quot;, root, onPlayerSpawn )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&amp;lt;section name=&amp;quot;client&amp;quot; class=&amp;quot;client&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
This example plays a sound when the player types the command '/sound'.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function onSoundEvent ( )&lt;br /&gt;
    playSoundFrontEnd ( 16 )&lt;br /&gt;
end&lt;br /&gt;
addCommandHandler(&amp;quot;sound&amp;quot;, onSoundEvent)&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;
{{Client_audio_functions}}&lt;br /&gt;
&lt;br /&gt;
[[de:playSoundFrontEnd]]&lt;br /&gt;
[[ar:playSoundFrontEnd]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PlaySound3D&amp;diff=45701</id>
		<title>PlaySound3D</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PlaySound3D&amp;diff=45701"/>
		<updated>2015-08-18T11:51:55Z</updated>

		<summary type="html">&lt;p&gt;VenadHD: /* Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__ &lt;br /&gt;
{{Client function}}&lt;br /&gt;
Creates a [[sound]] [[element]] in the GTA world and plays it immediately after creation for the local player. [[setElementPosition]] can be used to move the [[sound]] element around after it has been created. Remember to use [[setElementDimension]] after creating the sound to play it outside of dimension 0.&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' The only supported audio formats are MP3, WAV, OGG, RIFF, MOD, XM, IT and S3M.&lt;br /&gt;
{{Note|For performance reasons, when using playSound3D for effects that will be played lots (i.e. weapon fire), it is recommend that you convert your audio file to a one channel (mono) WAV with sample rate of 22050 Hz or less. Also consider adding a limit on how often the effect can be played e.g. once every 50ms.}}&lt;br /&gt;
==Syntax== &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;element playSound3D ( string soundPath, float x, float y, float z, [ bool looped = false, bool throttled = true ] )&amp;lt;/syntaxhighlight&amp;gt; &lt;br /&gt;
{{OOP||[[Sound|Sound3D]].create}}&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''soundPath:''' the [[filepath]] to the sound file you want to play. (Sound file has to be predefined in the [[meta.xml]] file with &amp;lt;file /&amp;gt; tag. And also can use url instead of [[filepath]] )&lt;br /&gt;
*'''x:''' a [[float]]ing point number representing the X coordinate on the map.&lt;br /&gt;
*'''y:''' a [[float]]ing point number representing the Y coordinate on the map.&lt;br /&gt;
*'''z:''' a [[float]]ing point number representing the Z coordinate on the map.&lt;br /&gt;
&lt;br /&gt;
===Optional Arguments=== &lt;br /&gt;
{{OptionalArg}} &lt;br /&gt;
*'''looped:''' A [[boolean]] representing whether the sound will be looped. To loop the sound, use ''true''.&lt;br /&gt;
{{New feature/item|3.0150|1.5||&lt;br /&gt;
*'''throttled:''' a [[boolean]] representing whether the sound will be throttled (i.e. given reduced download bandwidth). To throttle the sound, use ''true''. Sounds will be throttled per default and only for URLs.&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a [[sound]] [[element]] if the sound was successfully created, ''false'' otherwise.&lt;br /&gt;
&lt;br /&gt;
==Example== &lt;br /&gt;
This example creates a looping sound within a pizza shop. The pizza shop is in san fierro near pier 69&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;client&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;
function onResourceStart()&lt;br /&gt;
	local sound = playSound3D(&amp;quot;sounds/song.mp3&amp;quot;, 373.14, -125.21, 1001, true) &lt;br /&gt;
end&lt;br /&gt;
addEventHandler(&amp;quot;onClientResourceStart&amp;quot;, resourceRoot, onResourceStart)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
This example play internet radio in groove street.&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example 2&amp;quot; class=&amp;quot;client&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;
addEventHandler( 'onClientResourceStart', resourceRoot,&lt;br /&gt;
	function( )&lt;br /&gt;
		local uSound = playSound3D( 'http://193.34.51.25:80', 2498, -1659, 12 ) &lt;br /&gt;
		setSoundMaxDistance( uSound, 100 )&lt;br /&gt;
	end&lt;br /&gt;
)&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;
{{Client_audio_functions}}&lt;br /&gt;
[[AR:playSound3D]]&lt;br /&gt;
[[DE:playSound3D]]&lt;br /&gt;
[[RU:playSound3D]]&lt;/div&gt;</summary>
		<author><name>VenadHD</name></author>
	</entry>
</feed>