Jump to content

destroy blip?


Bean666

Recommended Posts

how could i destroy the blip that was attached to the destroyed marker and attach a new blip to the new created marker again?

function createMarkers ( ) 
        loc = math.random ( #markers ) 
        marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) 
        blip = createBlipAttachedTo(marker, 41) 
    end 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
if (hitPlayer == localPlayer) then 
    createMarkers() 
    destroyElement(source) 
    end 
end 
addEventHandler ( "onClientMarkerHit", resourceRoot, MarkerHit ) 

Link to comment

First you destroy the blip and after the marker, test it.

  
  
function createMarkers ( ) 
        loc = math.random ( #markers ) 
        marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) 
        blip = createBlipAttachedTo(marker, 41) 
    end 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
if (hitPlayer == localPlayer) then 
        destroyElement(blip ) 
    destroyElement(source) 
    createMarkers() 
    end 
end 
addEventHandler ( "onClientMarkerHit", resourceRoot, MarkerHit ) 
  
  

Link to comment
how could i destroy the blip that was attached to the destroyed marker and attach a new blip to the new created marker again?

Try this:

local blips = {} 
  
function createMarkers ( ) 
    loc = math.random ( #markers ) 
    marker = createMarker ( markers[loc][1], markers[loc][2], markers[loc][3], "cylinder", 5.0, 0, 0, 255, 150 ) 
    blips[marker] = createBlipAttachedTo(marker, 41) 
    addEventHandler ( "onClientMarkerHit", marker, MarkerHit ) 
end 
  
function MarkerHit ( hitPlayer, matchingDimension ) 
    if (hitPlayer == localPlayer) then 
      if blips[source] then  
         destroyElement(blips[source]) 
        destroyElement(source) 
        createMarkers() 
      end  
    end 
end 

Link to comment

btw i'm creating a marker and i have it on "corona", but it's creating a huge cylinder, even i change the size to 0

i used setMarkerSize , the size got small but the marker is so high , it's exceeding over the top.

nvm fixed.

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