SetElementDimension: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:


==Example==
==Example==
<section name="Server" class="server" show="false">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
addEventHandler ( "onPlayerEnterVehicle", root, "onPlayerEnterVehicle" )
function onPlayerEnterVehicle ( theVehicle, seat, jacked )
function onPlayerEnterVehicle ( theVehicle, seat, jacked )
   if ( getElementDimension ( source ) == 0 ) then -- if the player is in dimension 0
   if ( getElementDimension ( source ) == 0 ) then -- if the player is in dimension 0
Line 23: Line 23:
   end
   end
end
end
addEventHandler ( "onPlayerEnterVehicle", root, onPlayerEnterVehicle )


addEventHandler ( "onPlayerExitVehicle", root, "onPlayerExitVehicle" )
function onPlayerExitVehicle ( theVehicle, seat, jacker )
function onPlayerExitVehicle ( theVehicle, seat, jacker )
   if ( getElementDimension ( source ) == 1 ) then -- if the player is in dimension 1
   if ( getElementDimension ( source ) == 1 ) then -- if the player is in dimension 1
Line 31: Line 31:
   end
   end
end
end
addEventHandler ( "onPlayerExitVehicle", root, onPlayerExitVehicle )
</syntaxhighlight>
</syntaxhighlight>
</section>


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

Revision as of 12:01, 12 August 2007

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

Click to expand [+]
Server

See Also