element.setData

Revision as of 12:09, 27 April 2022 by Mex (talk | contribs)

Method Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0
Server:

void element.setData(string dataName, var theData, bool syncWithClientsNow = true)

Client:

void element.setData(string dataName, var theData)

The element.setData method is used to set a value for an element, referenced by a key.

The data will be sent to all clients when streaming in, so do not use element.setData() to store sensitive data like passwords.

Parameters

1) string dataName The string name of the data for the element.
2) var theData The data for the element, which is referenced by dataName.
3) bool syncWithClientsNow Whether the data is sent to clients immediately.
Note that all element data will be sent to a client when the element streams in.
This argument only applies when the method is used server-side.

Return

void This method doesn't return a value.

Types

Shared Blip
Shared Building
Shared Element
Shared Entity
Shared Marker
Shared Object
Shared Ped
Shared Physical
Shared Player
Shared Vehicle

Notes

  • The third arg (syncWithClients) is not available client side.

Examples

There aren't any examples for this method.

Compatibility

There isn't any compatibility information for this method.

Related

Server Related

        destroyElement
        getElementCount
        getElementFromId
        getElementFromName
        getElements
        getElementsByType

        element.children
        element.clearExistsFor
        element.dimension
        element.existsFor
        element.getData
        element.getRotation
        element.id
        element.isCreatedFor
        element.isLocal
        element.isOwner
        element.isSyncer
        element.isType
        element.name
        element.netFlags
        element.parent
        element.position
        element.removeAllData
        element.removeData
        element.resource
        element.rotation
        element.setData
        element.setExistsFor
        element.setRotation
        element.setSyncer
        element.streamInDistance
        element.streamOutDistance
        element.syncer
        element.syncerId
        element.type


Client Related

        destroyElement
      getElementCount
        getElementFromId
        getElementFromName
      getElements
        getElementsByType

        element.children
        element.clearExistsFor
        element.dimension
        element.existsFor
        element.getData
        element.getRotation
        element.id
        element.isCreatedFor
        element.isLocal
        element.isOwner
        element.isSyncer
        element.isType
        element.name
        element.netFlags
        element.parent
        element.position
        element.removeAllData
        element.removeData
        element.resource
        element.rotation
        element.setData
        element.setExistsFor
        element.setRotation
        element.setSyncer
        element.streamInDistance
        element.streamOutDistance
        element.syncer
        element.syncerId
        element.type