Jump to content

error help


Recommended Posts

Posted

in this script when the player be wasted in the first time the script move correct and destroy the elements. but in the second time with wasting i get error in destroyElement and the elements don't be removed:

function onWasted () 
        destroyElement (lowrider) 
        destroyElement (mission1BLIP) 
        destroyElement (mission1Marker) 
    end 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 

error:

Bad argument @ 'destroyElement' expected element at argument 1 

help please. thanks

Posted

That's because when you destroy an element ( lowrider for e.g. ) it's removed from that variable, So you must re-define it using that same variable at each time you create it.

Posted

use this:

  
function onWasted () 
    if ( isElement ( lowrider ) ) then destroyElement (lowrider) end 
    if ( isElement ( mission1BLIP ) ) then destroyElement (mission1BLIP) end 
    if ( isElement ( mission1Marker ) ) then destroyElement (mission1Marker) end 
end 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 
  
  

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