altmp / altv-js-module-v2

alt:V JavaScript v2 module
MIT License
10 stars 9 forks source link

[Feature Request]: Add the possibility to give entities an initial streamSyncedMeta data #215

Closed devpanda0 closed 3 months ago

devpanda0 commented 7 months ago

It is meant as with the VirtualEntity that you can specify initial streamSyncedMeta Data. It would be nice if this were available for everyone, where you can also set streamSyncedMeta

devpanda0 commented 7 months ago

A picture of what I mean image

xLuxy commented 3 months ago

Added in https://github.com/altmp/altv-js-module-v2/commit/6b0ea967a0c188828f99945401eaa95e6a5af44c (dev/0.0.0-dev.49)

Usage example:

import alt from '@altv/server';

const entity = alt.Vehicle.create({
  model: 'blista',
  pos: { x: 0, y: 0, z: 0 },
  initialData: {
    meta: {
      test: {
        value: 123,
        yes: false,
        meow: 'MEOW',
      },
    },
    syncedMeta: {
      test2: 123
    },
    streamSyncedMeta: {
      test3: 'meow'
    },
  },
});

alt.log(entity, entity.meta.test, entity.syncedMeta.test2, entity.streamSyncedMeta.test3);