Black2 Posted August 4, 2016 Share Posted August 4, 2016 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 ) Link to comment
Captain Cody Posted August 4, 2016 Share Posted August 4, 2016 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 ) Link to comment
Bonus Posted August 4, 2016 Share Posted August 4, 2016 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 ) Link to comment
Captain Cody Posted August 4, 2016 Share Posted August 4, 2016 Oh woops, didn't notice that. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now