getElementPosition
Client-side
Server-side
Shared
Pair: setElementPosition
This function allows you to retrieve the position coordinates of an element. This can be any real world element, including:
OOP Syntax Help! I don't understand this!
- Method: element:getPosition(...)
- Variable: .position
Syntax
float, float, float getElementPosition ( element theElement )
Required Arguments
- theElement: The element which you'd like to retrieve the position of.
Returns
- float: x
- float: y
- float: z
Returns three floats indicating the position of the element, x, y and z respectively.
Code Examples
client
This example will print the player position to chat using /pos command.
function whatsMyPosition() -- get the position of local player local fX, fY, fZ = getElementPosition(localPlayer);
-- output it to chat outputChatBox("My current position is X: "..fX.." Y: "..fY.." Z: "..fZ);endaddCommandHandler("pos", whatsMyPosition);
See Also
Element Functions
- attachElements
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAngularVelocity
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementType
- getElementVelocity
- getElementsByType
- getElementsWithinRange
- getLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement
- getRootElement
- hasElementData
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementOnFire
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementData
- setElementCollisionsEnabled
- setElementDoubleSided
- setElementDimension
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementOnFire
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneQuaternion
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementBoneQuaternion
- setElementCollidableWith
- setElementLighting
- setElementStreamable
- updateElementRpHAnim
- addElementDataSubscriber
- cloneElement
- clearElementVisibleTo
- getElementSyncer
- getElementZoneName
- hasElementDataSubscriber
- isElementVisibleTo
- removeElementData
- removeElementDataSubscriber
- setElementSyncer
- setElementVisibleTo
Element Events
- onClientElementColShapeLeave
- onClientElementDestroy
- onClientElementColShapeHit
- onClientElementDataChange
- onClientElementDimensionChange
- onClientElementModelChange
- onClientElementInteriorChange
- onClientElementStreamOut
- onClientElementStreamIn
- onElementClicked
- onElementColShapeLeave
- onElementColShapeHit
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync