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);
Gallery
Click on the image to view the full preview along with the description.
See Also
Element Functions
- attachElements
- createElement
- destroyElement
- detachElements
- getElementAlpha
- getAllElementData
- getAttachedElements
- getElementAngularVelocity
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChildren
- getElementChild
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementData
- getElementDimension
- getElementInterior
- getElementHealth
- getElementID
- getElementMatrix
- getElementModel
- getElementParent
- getElementRotation
- getElementPosition
- getElementVelocity
- getElementType
- getElementsByType
- getElementsWithinRange
- getLowLODElement
- getResourceDynamicElementRoot
- getRootElement
- hasElementData
- getResourceRootElement
- getPedContactElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementFrozen
- isElementOnFire
- isElementDoubleSided
- isElementInWater
- isElementLowLOD
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementOnFire
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneQuaternion
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementSyncer
- isElementWaitingForGroundToLoad
- isElementStreamedIn
- isElementStreamable
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneQuaternion
- setElementBoneRotation
- setElementCollidableWith
- setElementLighting
- setElementStreamable
- updateElementRpHAnim
- addElementDataSubscriber
- clearElementVisibleTo
- cloneElement
- getElementSyncer
- getElementZoneName
- hasElementDataSubscriber
- isElementVisibleTo
- removeElementDataSubscriber
- removeElementData
- setElementSyncer
- setElementVisibleTo
Element Events
- onClientElementColShapeLeave
- onClientElementColShapeHit
- onClientElementDataChange
- onClientElementDimensionChange
- onClientElementDestroy
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStopSync
- onElementStartSync