Jump to content

Destroy marker


SkatCh

Recommended Posts

Posted

guys please i need some i create a command to attach a marker to player then i create destroy function , check this it's a part from my script:

function destroyMarker (player) 
    for index, m in ipairs ( markers ) do 
        if isElement(markers[index][1]) and markers[index][2] == player then 
            destroyElement (markers[index][1]) 
            break 
        end 
    end 
end 

the problems is i want to destroy the marker when the player logout or when the player die .

i tried this but didn't work

function loggedOut (player) 
    destroyMarker (player) 
end 
addEventHandler("onPlayerLogout",getRootElement(),loggedOut) 
addEventHandler( "onPlayerWasted", getRootElement( ),loggedOut) 
addEventHandler ( "onPlayerQuit", getRootElement(), loggedOut ) 

Note i tried the same funtion with CommandHandler and it's working fine.

i'm sorry about my english

Posted
function loggedOut (player) 
    destroyMarker (player) 
end 

Remove 'player' from the function name, and change 'player' to 'source' in destroyMarker.

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