Jump to content

destroyElement issue


Recommended Posts

Hello guys.

I tried to make a job and i run in some issues.

function enter(thePlayer) 
    marker = createMarker(2809, -2474, 13, "cylinder", 2, 248, 211, 6, 153, thePlayer) 
    blip = createBlip(2809, -2474, 13, 0) 
    addEventHandler("onMarkerHit", marker, marcar) 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enter ) 
  
function marcar(thePlayer) 
    destroyElement(marker) 
    destroyElement(blip) 
end 

I simplify the code to this. The problem is with destroyElement of course.

Bad 'element' pointer @ 'destroyElement'(1) 

marker and blip is gone but i want to get rid of this warning.

Link to comment
Guest Guest4401
function marcar(thePlayer) 
    if isElement(marker) then 
        destroyElement(marker) 
    end 
    if isElement(blip) then 
        destroyElement(blip) 
    end 
end 

Link to comment
function enter(thePlayer) 
    marker = createMarker(2809, -2474, 13, "cylinder", 2, 248, 211, 6, 153, thePlayer) 
    blip = createBlip(2809, -2474, 13, 0) 
    addEventHandler("onMarkerHit", marker, marcar) 
end 
addEventHandler("onVehicleEnter", root, enter) 
  
function marcar(thePlayer) 
    if isElement(marker) then 
        removeEventHandler("onMarkerHit", marker, marcar) 
        destroyElement(marker) 
    end 
    if isElement(blip) then 
        destroyElement(blip) 
    end 
end 

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