Sign in to follow this  
Freamee

object in array, and delete it after

Recommended Posts

I have an array with an object, but i want to delete it from another command.

But its not working, due invalid function (destroy)

let mit = {
      x: player.position.x,
      y: player.position.y,
      z: player.position.z,
      ent: mp.objects.new(3469410940new mp.Vector3(player.position),
      {
            rotation: new mp.Vector3(0,0,90),
            alpha: 255,
            dimension: player.dimension
      })
    }
    let igen = JSON.stringify(mit);
    hulla.push(JSON.parse(igen));
 
 
hulla.forEach((entityindex=> {
        if(player.IsInRange(entity.xentity.yentity.z10)) {
          result = true;
          player.pushChat(`törölve: (${index}${entity.ent}`);
          hulla.splice(index1);
          entity.ent.destroy();
        }

Share this post


Link to post
Share on other sites

Why are you calling stringify and then parse? Stringify removes all functions of an object. Just push the created object into the array directly.

Share this post


Link to post
Share on other sites
21 hours ago, LeonMrBonnie said:

Why are you calling stringify and then parse? Stringify removes all functions of an object. Just push the created object into the array directly.

Appreciate your help. :3

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.