Jump to content

Blip is not being destroyed


Recommended Posts

Posted

Hello guys, I have a little problem. In my vehicle shops system I made a function that creates a blip which is attached to the vehicle that you bought. The only problem is that it's not being destroyed when I delete the vehicle, or if it's get blowned up. What's the problem with my code?

Here's a little part of it where I create and try to destroy the blip:

         if veh then 
            x, y, z = getElementPosition( veh ) 
            vehicleblip = createBlip( x, y, z, 55, 0, 0, 0, 255, thePlayer ) 
        end 
         
        addEventHandler("onElementDestroy", getRootElement(), function () 
            if veh then 
                destroyBlip(vehicleblip) 
            end 
        end) 

Thanks in advance!

Posted

How many blips are being created? if it's more than one, then the variable will be overwritten.

P.S: You aren't checking if "veh" is equal to "source", which is the element that was destroyed.

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...