element.setData: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
|class = Element
|class = Element
|name = setData
|name = setData
|parametersSS = string dataName, var theData, bool syncWithClients = true
|parametersSS = string dataName, var theData, bool syncWithClientsNow = true
|parametersCS = string dataName, var theData
|parametersCS = string dataName, var theData
|parameter1 = string dataName The string name of the data for the element.
|parameter1 = string dataName The string name of the data for the element.
|parameter2 = var theData The data for the element, which is referenced by dataName.
|parameter2 = var theData The data for the element, which is referenced by dataName.
|parameter3 = bool syncWithClients Whether '''dataName''' and '''theData''' are sent to all clients. This only applies when the method is used server-side.
|parameter3 = bool syncWithClientsNow Whether the data is sent to clients immediately.<br>Note that all element data will be sent to a client when the element streams in.<br>This argument only applies when the method is used server-side.
|returnTypes = void
|returnTypes = void
|returnInfo = void
|returnInfo = void
|returnFail1 = void
|returnFail1 = void
|usage = sets info, referenced by name
|usage = set a value for an element, referenced by a key.<br>
The data will be sent to all clients when streaming in, so do not use element.setData() to store sensitive data like passwords.
|notes = The third arg (syncWithClients) is not available client side.
|notes = The third arg (syncWithClients) is not available client side.
}}
}}

Revision as of 12:09, 27 April 2022

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

icon-iii.png icon-vc.png icon-sa.png icon-iv.png destroyElement
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementCount
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementFromId
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementFromName
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElements
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementsByType

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


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png destroyElement
icon-iii.png icon-vc.png icon-sa.png getElementCount
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementFromId
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementFromName
icon-iii.png icon-vc.png icon-sa.png getElements
icon-iii.png icon-vc.png icon-sa.png icon-iv.png getElementsByType

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