<?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=Pablo+Pizarro</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=Pablo+Pizarro"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/wiki/Special:Contributions/Pablo_Pizarro"/>
	<updated>2026-05-24T05:49:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GetElementAttachedOffsets&amp;diff=36536</id>
		<title>GetElementAttachedOffsets</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GetElementAttachedOffsets&amp;diff=36536"/>
		<updated>2013-07-04T13:13:16Z</updated>

		<summary type="html">&lt;p&gt;Pablo Pizarro: Fixed rz&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;
&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(getLocalPlayer()) -- 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>Pablo Pizarro</name></author>
	</entry>
</feed>