Skip to content

4. Auto Sync Keys

Stuyk edited this page Jul 2, 2023 · 1 revision

When you need to synchronize data down to the client, you can make certain keys automatically bound to setLocalMeta, setSyncedMeta, and setStreamSyncedMeta.

An example would be pushing the cash down to the local player to display it on screen.

Example

// Can be fetched on client-side with alt.getLocalMeta('cash');
crc.data.setKeysAsLocal(['cash', 'bank'])

// Can be fetched on client-side with alt.getStreamSyncedMeta('object-attachments');
crc.data.setKeysAsStreamSynced(['object-attachments']);

// Can be fetched on client-side with alt.getSyncedMeta('name');
crc.data.setKeysAsSynced(['name'])
Clone this wiki locally