SetElementData: Difference between revisions
Eficiencia (talk | contribs) No edit summary |
Eficiencia (talk | contribs) No edit summary |
||
Line 132: | Line 132: | ||
==See Also== | ==See Also== | ||
[[pt-br:SetElementData | [[pt-br:SetElementData]] | ||
{{Element_functions}} | {{Element_functions}} |
Revision as of 22:28, 6 August 2020
This function stores element data under a certain key, attached to an element. Element data set using this is then synced with all clients and the server. The data can contain server created elements, but you should avoid passing data that is not able to be synced such as xmlnodes, acls, aclgroups etc.
As element data is synced to all clients, it can generate a lot of network traffic and be heavy on performance. Events are much more efficient for sending data from a client to the server only, or from the server to a specific client.
Usage of element data should be disencouraged where your goal can be achieved with events like above, and tables for storing and retrieving data.
Tip: A simple and efficient way to make a variable known to the server and clients is to use setElementData on the root element. |
.
Syntax
bool setElementData ( element theElement, string key, var value [, bool synchronize = true ] )
OOP Syntax Help! I don't understand this!
- Method: element:setData(...)
- Counterpart: getElementData
Required Arguments
- theElement: The element you wish to attach the data to.
- key: The key you wish to store the data under. (Maximum 31 characters.)
- value: The value you wish to store. See element data for a list of acceptable datatypes.
Optional Arguments
- synchronize: Determines whether or not the data will be synchronized with the clients(server-side variation) or server(client-side variation)
Returns
Returns true if the data was set succesfully, false otherwise.
Issues
Issue ID | Description |
---|---|
#7389 | [Fixed in 1.3.5-7389] Problem with floating numbers |
Example
See 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