-
-
Notifications
You must be signed in to change notification settings - Fork 2
API: Syncer
Assetify provides integrated Global and Element Data synchronization features that are ready for immediate use. These functionalities operate on a table buffer and are compatible across various resources. Furthermore, we believe that MTA's setElementData and getElementData APIs fall short of expectations.
Add the below code globally once in either of the shared .lua
script of the resource you want to use within:
loadstring(exports.assetify_library:import("syncer"))()
-
✨ Sets a global data's value.
🚨 You can track any data changes via Assetify:onGlobalDataChange as per your requirements!local bool: result = assetify.syncer.setGlobalData( string: data, ~: value, bool: isSync )
-
✨ Retrieves specified global data's value.
local bool: result = assetify.syncer.getGlobalData( string: data )
-
✨ Retrieves all stored global datas.
local table: result = assetify.syncer.getAllGlobalDatas()
-
✨ Sets a element's data's value.
🚨 Client side setters aren't synced for security reasons.
🚨 You can track any data changes via Assetify:onEntityDataChange as per your requirements!local bool: result = assetify.syncer.setEntityData( element: element, string: data, ~: value, bool: isSync )
-
✨ Retrieves specified element's data's value.
local bool: result = assetify.syncer.getEntityData( element: element, string: data )
-
✨ Retrieves specified element's all stored entity datas.
local table: result = assetify.syncer.getAllEntityDatas( element: element )