Jump to content

[Help]Cancel Event


Black2

Recommended Posts

Posted

Hello, I've been having a problem to cancel an event if someone help me I thank you.

Well I want setElementData (hitElement, "Test2", true) is only available if the player is on the mark but to leave it still continues because it does not work?

Does anyone have any ideas :( ?

Thank you for your help. ^^

  
function Test( hitElement ) 
if getElementType ( hitElement ) == "player" then 
setElementData ( hitElement, "Test2", true ) 
end 
  
function markerLeave( leaveElement, matchingDimension ) 
        if getElementType( leaveElement ) == "player" then 
          outputChatBox ( "Player has left a marker", getRootElement(), 255, 255, 0 ) 
          setElementData ( hitElement, "Test2", false ) 
        end 
end 
addEventHandler( "onMarkerLeave", myMarker, markerLeave ) 

Posted
      
    function markerHit( hitElement ) 
    if getElementType ( hitElement ) == "player" then 
        setElementData ( hitElement, "Test2", true ) 
        end 
    end 
     
    addEventHandler( "onMarkerHit", myMarker, markerHit ) 
     
    function markerLeave( leaveElement, matchingDimension ) 
    if getElementType( leaveElement ) == "player" then 
        outputChatBox ( "Player has left a marker",root, 255, 255, 0 ) 
        setElementData ( hitElement, "Test2", false ) 
        end 
    end 
    addEventHandler( "onMarkerLeave", myMarker, markerLeave ) 

Posted
function Test( hitElement ) 
if getElementType ( hitElement ) == "player" then 
setElementData ( hitElement, "Test2", true ) 
end 
  
function markerLeave( leaveElement, matchingDimension ) 
        if getElementData ( leaveElement, "Test2" ) then       -- that should be better (optional) 
          outputChatBox ( "Player has left a marker", getRootElement(), 255, 255, 0 ) 
          setElementData ( leaveElement, "Test2", false )       -- You used hitElement here  
        end 
end 
addEventHandler( "onMarkerLeave", myMarker, markerLeave ) 

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