Sign in to follow this  
Snoozy

destroyElement wont destroy the element

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

Share this post


Link to post

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) 

Share this post


Link to post

@Solidsnake14: The creation of the marker and blip is serverside so that wouldn't work.

@Callum: They are both in the same resource just that creation is serverside

Share this post


Link to post

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.

Share this post


Link to post
Can the client destroy a server-side marker?

Yea... Lol that was the problem

Share this post


Link to post

So, the client can't destroy a server-side marker, i'am right?

Share this post


Link to post

Certainly seems so cause it worked once I placed all of it serverside

Share this post


Link to post

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.