GetElementCollisionsEnabled: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 7: Line 7:
bool getElementCollisionsEnabled ( element theElement )  
bool getElementCollisionsEnabled ( element theElement )  
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP|This function is also a static function underneath the Element class.|[[element]]:getCollisionsEnabled||}}
{{OOP|This function is also a static function underneath the Element class.|[[element]]:areCollisionsEnabled||}}
===Required Arguments===  
===Required Arguments===  
*'''theElement:''' The element for which you want to check whether collisions are enabled
*'''theElement:''' The element for which you want to check whether collisions are enabled

Revision as of 15:35, 16 August 2014

This function indicates if a specific element is set to have collisions disabled. An element without collisions does not interact with the physical environment and remains static.

Syntax

bool getElementCollisionsEnabled ( element theElement ) 

OOP Syntax Help! I don't understand this!

Note: This function is also a static function underneath the Element class.
Method: element:areCollisionsEnabled(...)


Required Arguments

  • theElement: The element for which you want to check whether collisions are enabled

Returns

Returns true if the collisions are enabled, false otherwise.

Example

This example check if there are any players with collisions disabled.

for _,player in ipairs( getElementsByType( "player" ) ) do
   if not getElementCollisionsEnabled( player ) then -- If we get a false return from the function, we know that the collisions are disabled.
      outputConsole( "Player " .. getPlayerName( player ) .. " has collisions disabled." ) 
   end
end

See Also