<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/MatrixPOP?action=history&amp;feed=atom</id>
	<title>MatrixPOP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/MatrixPOP?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MatrixPOP&amp;action=history"/>
	<updated>2026-05-25T19:20:31Z</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=MatrixPOP&amp;diff=78820&amp;oldid=prev</id>
		<title>Limedev: Removed unnecessary padding.</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MatrixPOP&amp;diff=78820&amp;oldid=prev"/>
		<updated>2024-02-14T12:56:55Z</updated>

		<summary type="html">&lt;p&gt;Removed unnecessary padding.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:56, 14 February 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__NOTOC__&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Useful Class}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Useful Class}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;__NOTOC__&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class allows you to handle matrixes without using MTA's OOP functions&amp;lt;br/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class allows you to handle matrixes without using MTA's OOP functions&amp;lt;br/&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class is called POP because it doesn't use any OOP functions while keeping Lua's class structure.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This class is called POP because it doesn't use any OOP functions while keeping Lua's class structure.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki_dev_:diff::1.12:old-74091:rev-78820 --&gt;
&lt;/table&gt;</summary>
		<author><name>Limedev</name></author>
	</entry>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=MatrixPOP&amp;diff=74091&amp;oldid=prev</id>
		<title>Tracer: Created page with &quot;{{Useful Class}} __NOTOC__ This class allows you to handle matrixes without using MTA's OOP functions&lt;br/&gt; This class is called POP because it doesn't use any OOP functions while keeping Lua's class structure.  ==Syntax== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; MatrixPOP MatrixPOP( element eheElement ) &lt;/syntaxhighlight&gt;  ===Required Arguments===  *'''theElement:''' The element which you wish to retrieve the matrix for.  ===Returns=== Returns a matrix class&lt;br/&gt; Returns ''f...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=MatrixPOP&amp;diff=74091&amp;oldid=prev"/>
		<updated>2022-02-16T19:47:17Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Class}} __NOTOC__ This class allows you to handle matrixes without using MTA&amp;#039;s OOP functions&amp;lt;br/&amp;gt; This class is called POP because it doesn&amp;#039;t use any OOP functions while keeping Lua&amp;#039;s class structure.  ==Syntax== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; MatrixPOP MatrixPOP( element eheElement ) &amp;lt;/syntaxhighlight&amp;gt;  ===Required Arguments===  *&amp;#039;&amp;#039;&amp;#039;theElement:&amp;#039;&amp;#039;&amp;#039; The &lt;a href=&quot;/wiki/Element&quot; title=&quot;Element&quot;&gt;element&lt;/a&gt; which you wish to retrieve the &lt;a href=&quot;/wiki/Matrix&quot; title=&quot;Matrix&quot;&gt;matrix&lt;/a&gt; for.  ===Returns=== Returns a matrix class&amp;lt;br/&amp;gt; Returns &amp;#039;&amp;#039;f...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Class}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This class allows you to handle matrixes without using MTA's OOP functions&amp;lt;br/&amp;gt;&lt;br /&gt;
This class is called POP because it doesn't use any OOP functions while keeping Lua's class structure.&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
MatrixPOP MatrixPOP( element eheElement )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments=== &lt;br /&gt;
*'''theElement:''' The [[element]] which you wish to retrieve the [[matrix]] for.&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
Returns a matrix class&amp;lt;br/&amp;gt;&lt;br /&gt;
Returns ''false'' if the element is not streamed in, and not a [[vehicle]], [[ped]] or [[object]].&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
MatrixPOP = setmetatable({},{&lt;br /&gt;
    __metatable = 'MatrixPOP',&lt;br /&gt;
    __call = function(self,ply)&lt;br /&gt;
        local matrixObj = {}&lt;br /&gt;
        setmetatable(matrixObj, self)&lt;br /&gt;
        self.__index = self&lt;br /&gt;
        &lt;br /&gt;
        if not isElement(ply) or (&lt;br /&gt;
            getElementType(ply) ~= 'player' and&lt;br /&gt;
            getElementType(ply) ~= 'vehicle' and&lt;br /&gt;
            getElementType(ply) ~= 'object'&lt;br /&gt;
        ) then return false end&lt;br /&gt;
&lt;br /&gt;
        matrixObj.matrix = getElementMatrix(ply)&lt;br /&gt;
        matrixObj.rotation = { getElementRotation(ply) }&lt;br /&gt;
&lt;br /&gt;
        return matrixObj&lt;br /&gt;
    end&lt;br /&gt;
})&lt;br /&gt;
function MatrixPOP:getRotation()&lt;br /&gt;
    if not self then return false end&lt;br /&gt;
    return Vector3(self.rotation[1],self.rotation[2],self.rotation[3])&lt;br /&gt;
end&lt;br /&gt;
function MatrixPOP:getLeft()&lt;br /&gt;
    if not self then return false end&lt;br /&gt;
    local matrix = self.matrix[1]&lt;br /&gt;
    return Vector4(matrix[1], matrix[2], matrix[3], 1)&lt;br /&gt;
end&lt;br /&gt;
function MatrixPOP:getForward()&lt;br /&gt;
    if not self then return false end&lt;br /&gt;
    local matrix = self.matrix[2]&lt;br /&gt;
    return Vector4(matrix[1], matrix[2], matrix[3], 1)&lt;br /&gt;
end&lt;br /&gt;
function MatrixPOP:getUp()&lt;br /&gt;
    if not self then return false end&lt;br /&gt;
    local matrix = self.matrix[3]&lt;br /&gt;
    return Vector4(matrix[1], matrix[2], matrix[3], 1)&lt;br /&gt;
end&lt;br /&gt;
function MatrixPOP:getPosition()&lt;br /&gt;
    if not self then return false end&lt;br /&gt;
    local matrix = self.matrix[4]&lt;br /&gt;
    return Vector4(matrix[1], matrix[2], matrix[3], 1)&lt;br /&gt;
end&lt;br /&gt;
function MatrixPOP:__tostring()&lt;br /&gt;
    local matrix = self.matrix&lt;br /&gt;
    local m1 = matrix[1]&lt;br /&gt;
    local m2 = matrix[2]&lt;br /&gt;
    local m3 = matrix[3]&lt;br /&gt;
    local m4 = matrix[4]&lt;br /&gt;
    m1 = ('{ %s, %s, %s }'):format(m1[1],m1[2],m1[3])&lt;br /&gt;
    m2 = ('{ %s, %s, %s }'):format(m2[1],m2[2],m2[3])&lt;br /&gt;
    m3 = ('{ %s, %s, %s }'):format(m3[1],m3[2],m3[3])&lt;br /&gt;
    m4 = ('{ %s, %s, %s }'):format(m4[1],m4[2],m4[3])&lt;br /&gt;
&lt;br /&gt;
    return ('MatrixPOP: {\n%s,\n%s,\n%s,\n%s\n}'):format(m1,m2,m3,m4)&lt;br /&gt;
end&lt;br /&gt;
collectgarbage('setpause',100)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Transform player's matrix into MatrixPOP&lt;br /&gt;
&amp;lt;section name=&amp;quot;Example&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
addEventHandler('onPlayerJoin',root,function()&lt;br /&gt;
    local matrix = MatrixPOP(source)&lt;br /&gt;
    local position = matrix:getPosition()&lt;br /&gt;
    outputChatBox(('Your coordinates are: %s, %s, %s'):format(position.x, position.y, position.z)&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;
{{Useful_Classes}}&lt;/div&gt;</summary>
		<author><name>Tracer</name></author>
	</entry>
</feed>