Jump to content

Destroy blip


kev|GER

Recommended Posts

Hello,

I've got a couple of questions, I'd like to know how to delete a blip attached to a player, and a way of getting it back, matching the team color and stuff.

I've tried destroyBlipAttachedTo, as mentioned in some topics over this forum, but that function doesn't even exists. I've seen examples of removing the blip when the player connects, but what about when a command is activated? Like a script that would make the player lose its blip, and then , with a toggle, attach the blip back? The attachment of the blip is easy, as it would only be createBlipAttachedTo, but I'd like to know how how get the blip that is a attached to the source, and use destroyElement to destroy it.

Thanks in advance,

-kev

Link to comment

There is no destroyBlipAttachedTo, if you have seen it then it's a custom function:

function destroyBlipAttachedTo(player) 
    local attachedElements = getAttachedElements(player) 
    if attachedElements then 
        for i, attachedElement in ipairs(attachedElements) do 
            if getElementType(attachedElement) == "blip" then 
                destroyElement(attachedElement) 
            end 
        end 
    end 
end 

And just use createBlipAttachedTo to create the blip again.

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...