IsElementDoubleSided: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '{{Server client function}} __NOTOC__ This function checks whether an element is double-sided as set by setElementDoubleSided or not. ==Syntax== <syntaxhighlight lang="lua"> bool isElementD…')
 
No edit summary
 
(4 intermediate revisions by 4 users not shown)
Line 7: Line 7:
bool isElementDoubleSided ( element theElement )
bool isElementDoubleSided ( element theElement )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[element]]:isDoubleSided|doubleSided|setElementDoubleSided}}


===Required Arguments===
===Required Arguments===
Line 15: Line 16:


==Example==
==Example==
This example checks if the object created is breakable and if it is then breaks it.
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addCommandHandler("createObj",
function(plr, command, id)
    local x, y, z = getElementPosition(plr)
    local object = createObject (id, x, y, z)
    if (isElementDoubleSided(object)) then  -- checks if it is double sided or not
      outputChatBox("The object is double sided", plr)
    else
      outputChatBox("The object is not double sided", plr)
    end
end
)
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Element functions}}
{{Element functions}}

Latest revision as of 16:30, 6 August 2016

This function checks whether an element is double-sided as set by setElementDoubleSided or not.

Syntax

bool isElementDoubleSided ( element theElement )

OOP Syntax Help! I don't understand this!

Method: element:isDoubleSided(...)
Variable: .doubleSided
Counterpart: setElementDoubleSided


Required Arguments

  • theElement: The element in which you'd like to check the double-sidedness of.

Returns

Returns true if the theElement is double-sided, false otherwise.

Example

This example checks if the object created is breakable and if it is then breaks it.

Click to collapse [-]
Server
addCommandHandler("createObj",
function(plr, command, id)
    local x, y, z = getElementPosition(plr)
    local object = createObject (id, x, y, z)
    if (isElementDoubleSided(object)) then  -- checks if it is double sided or not
       outputChatBox("The object is double sided", plr)
    else
       outputChatBox("The object is not double sided", plr)
    end
end
)

See Also