Jump to content

destroyElement wont destroy the element


Snoozy

Recommended Posts

So for some reason destroyElement() wont destroy the thing I asks it to.

function MarkerHit ( hitPlayer, matchingDimension ) 
    if source == getElementData(hitPlayer,"Marker") then 
        outputChatBox("Hit the marker",hitPlayer) 
                            local Marker = getElementData(getLocalPlayer(),"Marker") 
        destroyElement(Marker) 
        local Blip = getElementData(getLocalPlayer(),"Blip") 
        destroyElement (Blip) 
    end 
end 
addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) 

Not either the Marker or the Blip gets destroyed.

The data is set here:

local Blip = createBlip(X,Y,Z,31,0, 0, 0, 255,source) 
                local Marker = createMarker(X,Y,Z,"checkpoint",1.0,0,255,0,170,source) 
                setElementData(source,"Marker",Marker) 
                setElementData(source,"Blip",Blip) 

They do appear ingame the created marker and blip

Link to comment

Try this:

local Blip = createBlip(X,Y,Z,31,0, 0, 0, 255,source) 
local Marker = createMarker(X,Y,Z,"checkpoint",1.0,0,255,0,170,source) 
setElementData(getLocalPlayer(),"Marker",Marker) 
setElementData(getLocalPlayer(),"Blip",Blip) 

Link to comment

why are you using hitPlayer but then getting local player element data? maybe i dont understand the purpose of this (actually, i dont), but what if some other player hits the marker?

and what is the source in the second part?

ps: clientside outputChatBox does not have any element input parameters, it outputs to local player only.

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