SetElementDimension: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
This function allows you to set the dimension of any element. The dimension determines what/who the element is visible to.
This function allows you to set the [[dimensions|dimension]] of any element. The dimension determines what/who the element is visible to.


==Syntax==
==Syntax==

Revision as of 23:04, 22 September 2006

This function allows you to set the dimension of any element. The dimension determines what/who the element is visible to.

Syntax

bool setElementDimension ( element theElement, int dimension )

Required Arguments

  • theElement: The element in which you'd like to set the dimension of.
  • dimension: An integer representing the dimension ID

Returns

Returns 'true' if 'theElement' and 'dimension' is valid, 'false' otherwise.

Example

addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( theVehicle, seat, jacked )
  if ( getElementDimension ( source ) == 0 ) then -- if the player is in dimension 0
    setElementDimension ( source, 1 ) -- set his dimension to 1
    setElementDimension ( theVehicle, 1 ) -- set his vehicle's dimension to 1 aswell
  end
end

addEventHandler ( "onPlayerExitVehicle", root, "onPlayerExitVehicle" )
function onPlayerExitVehicle ( theVehicle, seat, jacker )
  if ( getElementDimension ( source ) == 1 ) then -- if the player is in dimension 1
    setElementDimension ( source, 0 ) -- set his dimension back to 0
    setElementDimension ( theVehicle, 0 ) -- set his vehicle's dimension back to 0 aswell
  end
end

See Also