SetElementInterior: Difference between revisions
Jump to navigation
Jump to search
(Fix oop syntax) |
|||
(13 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function allows you to set the interior of any element. An interior is the current loaded place, 0 being outside. | This function allows you to set the [[interior]] of any element. An interior is the current loaded place, 0 being outside. | ||
{{Note|If passing the same interior as the element is in, the call will be ignored and position (optional arguments) will not be set either. Use [[setElementPosition]] separately to be sure the position will be set.}} | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setElementInterior ( element theElement, int interior, | bool setElementInterior ( element theElement, int interior [, float x, float y, float z] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:setInterior|interior|getElementInterior}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theElement:''' The element in which you'd like to set the interior of. | *'''theElement:''' The element in which you'd like to set the interior of. | ||
*'''interior:''' The interior you want to set the element to. | *'''interior:''' The interior you want to set the element to. Valid values are 0 to 255. | ||
===Optional Arguments=== | |||
{{OptionalArg}} | |||
* '''x:''' A floating point number representing the X coordinate on the map. | |||
* '''y:''' A floating point number representing the Y coordinate on the map. | |||
* '''z:''' A floating point number representing the Z coordinate on the map. | |||
===Returns=== | ===Returns=== | ||
Returns 'true' if ' | Returns ''true'' if '''theElement''' and '''interior''' are valid arguments, ''false'' otherwise. | ||
==Example== | ==Example== | ||
<section name="Server | <section name="Server" class="server" show="true"> | ||
In this example, if a player were to type /interior 1, they would be teleported into this interior | In this example, if a player were to type /interior 1, they would be teleported into this interior | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function interior ( source, | function interior ( source, commandName, interior ) | ||
-- | --Let's see if they gave an interior ID | ||
if ( interior | if ( interior ) then | ||
--They did, so lets assign them to that interior and teleport them there (all in 1 function call!) | --They did, so lets assign them to that interior and teleport them there (all in 1 function call!) | ||
setElementInterior ( source, interior, 2233.91, 1714.73, 1011.38 ) | setElementInterior ( source, interior, 2233.91, 1714.73, 1011.38 ) | ||
else | else | ||
--They | --They didn't give one, so set them to the interior they wanted, but don't teleport them. | ||
setElementInterior ( source, interior ) | setElementInterior ( source, 0 ) | ||
end | |||
end | |||
addCommandHandler ( "interior", interior ) | |||
</syntaxhighlight> | |||
</section> | |||
<section name="Client" class="client" show="true"> | |||
In this example, if a player were to type /interior 1, they would be teleported into this interior | |||
<syntaxhighlight lang="lua"> | |||
function interior ( commandName, interior ) | |||
--Let's see if they gave a interior ID | |||
if ( interior ) then | |||
--They did, so let's assign them to that interior and teleport them there (all in 1 function call!) | |||
setElementInterior ( localPlayer, interior, 2233.91, 1714.73, 1011.38 ) | |||
else | |||
--They didn't give one, so set them to the interior they wanted, but don't teleport them. | |||
setElementInterior ( localPlayer, 0 ) | |||
end | end | ||
end | end | ||
Line 40: | Line 60: | ||
==See Also== | ==See Also== | ||
{{Element functions}} | {{Element functions}} | ||
[[de:setElementInterior]] |
Latest revision as of 13:55, 6 August 2016
This function allows you to set the interior of any element. An interior is the current loaded place, 0 being outside.
Note: If passing the same interior as the element is in, the call will be ignored and position (optional arguments) will not be set either. Use setElementPosition separately to be sure the position will be set. |
Syntax
bool setElementInterior ( element theElement, int interior [, float x, float y, float z] )
OOP Syntax Help! I don't understand this!
- Method: element:setInterior(...)
- Variable: .interior
- Counterpart: getElementInterior
Required Arguments
- theElement: The element in which you'd like to set the interior of.
- interior: The interior you want to set the element to. Valid values are 0 to 255.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- x: A floating point number representing the X coordinate on the map.
- y: A floating point number representing the Y coordinate on the map.
- z: A floating point number representing the Z coordinate on the map.
Returns
Returns true if theElement and interior are valid arguments, false otherwise.
Example
Click to collapse [-]
ServerIn this example, if a player were to type /interior 1, they would be teleported into this interior
function interior ( source, commandName, interior ) --Let's see if they gave an interior ID if ( interior ) then --They did, so lets assign them to that interior and teleport them there (all in 1 function call!) setElementInterior ( source, interior, 2233.91, 1714.73, 1011.38 ) else --They didn't give one, so set them to the interior they wanted, but don't teleport them. setElementInterior ( source, 0 ) end end addCommandHandler ( "interior", interior )
Click to collapse [-]
ClientIn this example, if a player were to type /interior 1, they would be teleported into this interior
function interior ( commandName, interior ) --Let's see if they gave a interior ID if ( interior ) then --They did, so let's assign them to that interior and teleport them there (all in 1 function call!) setElementInterior ( localPlayer, interior, 2233.91, 1714.73, 1011.38 ) else --They didn't give one, so set them to the interior they wanted, but don't teleport them. setElementInterior ( localPlayer, 0 ) end end addCommandHandler ( "interior", interior )
See Also
- addElementDataSubscriber
- clearElementVisibleTo
- cloneElement
- getAllElementData
- getElementSyncer
- getElementZoneName
- hasElementDataSubscriber
- isElementVisibleTo
- removeElementData
- removeElementDataSubscriber
- setElementSyncer
- setElementVisibleTo
Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement