Sign in to follow this  
MarkCavalli

entityStreamIn and entityStreamOut temporary fix for objects

Recommended Posts

paste this code inside client_packages folder

 

class Singleton {
  constructor() {
    setInterval(() => {
      this.checkEvent();
    }, 250);
  }

  checkEvent() {
    mp.objects.forEach((object) => {
      if (object.handle) {
        this.checkForStreamIn(object);
      }
      else {
        this.checkForStreamOut(object);
      }
    });
  }

  checkForStreamIn(object) {
    if (object.isInStreamRange) return;
    object.isInStreamRange = true;
    mp.events.call('entityStreamIn', object);
  }

  checkForStreamOut(object) {
    if (!object.isInStreamRange) return;
    object.isInStreamRange = false;
    mp.events.call('entityStreamOut', object);
  }
}
new Singleton();

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.