SetElementID
From Multi Theft Auto: Wiki
This function sets the ID of an element to a string. This can be anything from an identifying number, to a name. You can only change the ID of an element clientside if that element has been created clientside as well.
Syntax
bool setElementID ( element theElement, string name )
OOP Syntax Help! I don't understand this!
- Method: element:setID(...)
- Variable: .id
- Counterpart: getElementID
Required Arguments
- theElement: The element you want to set the ID of.
- name: The new ID for theElement.
Returns
This returns true if successful. It will return false if theElement is invalid, or does not exist, or if name is invalid, or is not a string.
Example
local players = getElementsByType( "player" ) for i=1,#players do setElementID( players[i], "player" .. i ) -- Change element IDs to 'player1', 'players2', 'players3'... outputDebugString( "Player[" .. i .. "] = " .. getElementID( players[i] ) ) -- Output all the new element IDs end -- Could also be -- for i=1,#players do setElementID( players[i], getPlayerName( players[i] ) ) -- Change the element ID to the players name. outputDebugString( "Player[" .. i .. "] = " .. getElementID( players[i] ) ) end
See Also
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementCollisionsEnabled
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementColShape
- getElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getElementsByType
- getElementsWithinColShape
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementVisibleTo
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement