<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/GuiCancelMoveElement?action=history&amp;feed=atom</id>
	<title>GuiCancelMoveElement - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/GuiCancelMoveElement?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCancelMoveElement&amp;action=history"/>
	<updated>2026-05-10T09:24:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=GuiCancelMoveElement&amp;diff=72046&amp;oldid=prev</id>
		<title>Arlixx: Created page with &quot;{{Useful Function}} &lt;lowercasetitle/&gt; __NOTOC__ This function Cancel moves guiElement by/like using moveObject  ==Syntax== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; guiCancelMoveElement (...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=GuiCancelMoveElement&amp;diff=72046&amp;oldid=prev"/>
		<updated>2021-09-11T20:25:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Function}} &amp;lt;lowercasetitle/&amp;gt; __NOTOC__ This function Cancel moves guiElement by/like using moveObject  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; guiCancelMoveElement (...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Function}}&lt;br /&gt;
&amp;lt;lowercasetitle/&amp;gt;&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function Cancel moves guiElement by/like using moveObject&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
guiCancelMoveElement ( element guiElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''guiElement''': the GUI element that will be cancel moved.&lt;br /&gt;
&lt;br /&gt;
==Code==&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;
function guiCancelMoveElement(element)&lt;br /&gt;
    for i, gui_elements in ipairs ( table_ ) do&lt;br /&gt;
        if gui_elements[1] == element then&lt;br /&gt;
            table.remove ( table_, i )&lt;br /&gt;
            if isElement ( gui_elements[2] ) then&lt;br /&gt;
                destroyElement ( gui_elements[2] )&lt;br /&gt;
            end&lt;br /&gt;
        end&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;
&amp;lt;br /&amp;gt;'''Author:''' [https://wiki.multitheftauto.com/wiki/User:Arlixx ArLixx]&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Examples==&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;
&lt;br /&gt;
&lt;br /&gt;
local table_ = {}&lt;br /&gt;
function guiMoveElement ( element, speed, x, y, type_ )&lt;br /&gt;
	local type_ = type_ or &amp;quot;Linear&amp;quot;&lt;br /&gt;
	if isElement ( element ) and tonumber ( speed ) and tonumber ( x ) and tonumber ( y ) and tostring ( type_ ) then&lt;br /&gt;
		if isElement ( getElementData ( element, &amp;quot;object&amp;quot; ) ) then&lt;br /&gt;
			local object = getElementData ( element, &amp;quot;object&amp;quot; )&lt;br /&gt;
			moveObject ( object, speed, x, y, -999, 0, 0, 0, type_ )&lt;br /&gt;
			local destroy = function ( old_object, old_gui )&lt;br /&gt;
				if isElement ( old_object ) then&lt;br /&gt;
					destroyElement ( old_object )&lt;br /&gt;
				end&lt;br /&gt;
				for i, gui_elements in ipairs ( table_ ) do&lt;br /&gt;
					if gui_elements[1] == old_gui then&lt;br /&gt;
						table.remove ( table_, i )&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			setTimer ( destroy, speed, 1, object, gui_element )&lt;br /&gt;
		else&lt;br /&gt;
			local p = { guiGetPosition ( element, false ) }&lt;br /&gt;
			local object = createObject ( 902, p[1], p[2], -999 )&lt;br /&gt;
			setElementData ( element, &amp;quot;object&amp;quot;, object )&lt;br /&gt;
			setElementAlpha ( object, 0 )&lt;br /&gt;
			table.insert ( table_, (#table_)+1, { element, object } )&lt;br /&gt;
			guiMoveElement ( element, speed, x, y, type_ )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
function r ()&lt;br /&gt;
	for i, gui_element in ipairs ( table_ ) do&lt;br /&gt;
		if isElement (gui_element[1]) and isElement (gui_element[2]) then&lt;br /&gt;
			local x, y = getElementPosition ( gui_element[2] )&lt;br /&gt;
			guiSetPosition ( gui_element[1], x, y, false )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
addEventHandler ( &amp;quot;onClientRender&amp;quot;, root, r )&lt;br /&gt;
&lt;br /&gt;
function guiCancelMoveElement(element)&lt;br /&gt;
    for i, gui_elements in ipairs ( table_ ) do&lt;br /&gt;
        if gui_elements[1] == element then&lt;br /&gt;
            table.remove ( table_, i )&lt;br /&gt;
            if isElement ( gui_elements[2] ) then&lt;br /&gt;
                destroyElement ( gui_elements[2] )&lt;br /&gt;
            end&lt;br /&gt;
        end&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&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;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>Arlixx</name></author>
	</entry>
</feed>