Resource:EntityData: Difference between revisions
(Created page with "{{Resource page}} <div style="padding:10px; border-radius:2px;font-size:14px;"> '''Name''': entityData '''Developer''': User:GalAnonim (Rick) '''State''': <span style="color:#55FF55;text-shadow:black 0em 0em 0.3em;">OpenSource</span> '''GitHub Source''': https://github.com/httpRick/entityData/tree/main '''Current Version''': 1.0.0 </div> == Overview == The system of non-standard data operation for Elements on the MTA SA platform replaces ElementData ==Exporte...") |
No edit summary |
||
Line 104: | Line 104: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''var key:''' The name of the entity data entry you want to check for. | *'''var key:''' The name of the entity data entry you want to check for. | ||
*'''table flag:''' A flag containing all the restrictions key | *'''table flag:''' A flag containing all the [https://wiki.multitheftauto.com/wiki/Resource:EntityData/restrictions_key restrictions key] | ||
===Returns=== | ===Returns=== | ||
Returns true if the flag is set and false if the flag is not set on the key. | Returns true if the flag is set and false if the flag is not set on the key. | ||
</section> | </section> |
Revision as of 01:53, 26 November 2021
Name: entityData
Developer: User:GalAnonim (Rick)
State: OpenSource
GitHub Source: https://github.com/httpRick/entityData/tree/main
Current Version: 1.0.0
Overview
The system of non-standard data operation for Elements on the MTA SA platform replaces ElementData
Exported functions
setEntityData
This function passes user information about the element to entity Data, the data can be created by the server but you should avoid passing data from client to server when assigning.
This function encrypts the data of the file
string exports.entityData:setEntityData(element/table theElement, var/table key, var value, [string type="public", int transaction])
Required Arguments
- element theElement: The element/elements you wish to attach the data to.
- var key: The key/keys you wish to store the data under.
Optional Arguments
- string type: type of data synchronization
- "public" - Synchronizes between the server and the client, and between the client and the server (required to be enabled in the options)
- "local" - It does not synchronize, it remains on the side on which it was given
- "private" - Assigns and synchronizes one value for a given key for all items
- int transaction: - The transaction number, if this value is provided, the data transfer will not be executed immediately
Returns
Returns true if the data was set succesfully, false otherwise.
getEntityData
This function retrieves entity data attached to an element under a certain key.
This function encrypts the data of the file
string exports.entityData:getEntityData(element/table theElement, var/table key, [string type="public"])
Required Arguments
- element theElement: This is the element/elements with data you want to retrieve.
- var key: The name/names of the entity data entry you want to retrieve.
Optional Arguments
- string type: type of data synchronization
- "public" - Synchronizes between the server and the client, and between the client and the server (required to be enabled in the options)
- "local" - It does not synchronize, it remains on the side on which it was given
- "private" - Assigns and synchronizes one value for a given key for all items
Returns
This function returns a variable/tables containing the requested entity data, or false if the element/elements or the entity data does not exist.
getAllEnintyData
This function returns a table of all entity data of an element.
string exports.entityData:getAllEnintyData(element/table theElement, [string type="public"])
Required Arguments
- element theElement: This is the element/elements with data you want to retrieve.
Optional Arguments
- string type: type of data synchronization
- "public"
- "local"
- "private"
- "all"
Returns
If successful, returns a table with as keys the names of the entity data and as values the corresponding entity data values. Returns false in case of failure.
hasEntityData
This function checks if an element has entity data available under a certain key.
string exports.entityData:hasEntityData(element/table theElement, var/table key, [string type="public"])
Required Arguments
- element theElement: This is the element/elements with data you want to retrieve.
- var key: The name/names of the entity data entry you want to check for.
Optional Arguments
- string type:type of data synchronization
- "public" - Synchronizes between the server and the client, and between the client and the server (required to be enabled in the options)
- "local" - It does not synchronize, it remains on the side on which it was given
- "private" - Assigns and synchronizes one value for a given key for all items
Returns
This function returns true if the element contains entity data for key, or false if the element doesn't exist or there is no data associated with the key.
setKeyFlag
This function imposes restrictions on the key which, if not satisfied, will not perform the entity data assignment
string exports.entityData:setKeyFlag(var key, table flag)
Required Arguments
- var key: The name of the entity data entry you want to check for.
- table flag: A flag containing all the restrictions key
Returns
Returns true if the flag is set and false if the flag is not set on the key.