Sign in to follow this  
Buckets

Client side blips that get removed once the player arrives to it?

Recommended Posts

Buckets    0

When I tried using the server side blips it would still show up for everyone when they typed the command. I also tried making it so it gets removed once they arrive to the destination but it only worked if they typed the command at the destination.

What is the best way to make a blip for one player that will be removed once they arrive to it? Your help would be appreciated.

This is what I had, but I'm pretty sure it still shows the blip for everyone.

mp.events.addCommand("routeBlip", (player) => {
  let position = new mp.Vector3(37.563, 6379.244, 31.040);
  let blip = mp.blips.new(1, position);
  blip.routeFor(player, 1, 1);
  let pos = player.position
  let blipPos = mp.colshapes.newSphere(37.563, 6379.244, 31.040, 3);
  
    removeBlip(blip, blipPos, pos);
});

function removeBlip(blip, blipPos, pos) {
  if (blipPos.isPointWithin(pos)) {
    blip.destroy();
  }
}

 

Share this post


Link to post
Share on other sites
Captien    29

You should create a function outside the command firstly and do what you want in it, then call it inside your command so the function stays active till the player hits the colshape, your code only checks if the player has hit the colshape or not when the command is executed.

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.