SetElementPosition: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 2: | Line 2: | ||
{{Server client function}} | {{Server client function}} | ||
This function sets the position of an element to the specified coordinates. | This function sets the position of an element to the specified coordinates. | ||
<div style="background: #FF7070; border: 3px solid #FF0000;"> | |||
'''Attention:''' Do not use this function to spawn a [[ped]]/[[player]]. It will cause problems with other functions like [[warpPedIntoVehicle]]. <br> | |||
Use [[spawnPlayer]] and [[createPed]] instead. | |||
</div> | |||
==Syntax== | ==Syntax== |
Revision as of 11:39, 3 May 2013
This function sets the position of an element to the specified coordinates.
Attention: Do not use this function to spawn a ped/player. It will cause problems with other functions like warpPedIntoVehicle.
Use spawnPlayer and createPed instead.
Syntax
bool setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] )
Required Arguments
- theElement: A valid element to be moved.
- x: The x coordinate of the destination.
- y: The y coordinate of the destination.
- z: The z coordinate of the destination.
Optional Arguments
- warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation.
Returns
Returns true if the function was successful, false otherwise.
Example
Click to collapse [-]
Example 1This example adds a "setpos" command to console, which allows setting of a player's position.
function consoleSetPlayerPosition ( source, commandName, posX, posY, posZ ) setElementPosition ( source, posX, posY, posZ ) end addCommandHandler ( "setpos", consoleSetPlayerPosition )
Click to expand [+]
Example 2Click to expand [+]
Example 3See Also
- 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