Jump to content

[Solved] Attaching an event to a certain marker


ManeXi

Recommended Posts

Posted (edited)

I want to attach an event to only 1 certain marker, I have tried this:

local eventMarker = createMarker(2031.0009765625, -1417.849609375, 18, "arrow", 2.0, 0, 255, 0, 200) 
addEventHandler("onPlayerMarkerHit", eventMarker, theFunction) 

but it doesn't work :(

Edited by Guest
Posted

Use this:

local eventMarker = createMarker(2031.0009765625, -1417.849609375, 18, "arrow", 2.0, 0, 255, 0, 200) 
addEventHandler("onPlayerMarkerHit", getRootElement(), theFunction) 

And in the function add a check like this, to see if the marker that was hit is eventMarker:

theFunction (markerHit) 
if markerHit == eventMarker then 
--your code 
end 
end 

Posted
Better do what Walid told you, better for the performance.

I gave him the solution for the event he was using, he did not ask for better perfomance...

And I didn't say your solution is wrong.

Just wanted to say that he should better use the other event :D

Posted

When helping other people, try to give them solutions for better performance, while also fixing their original problems, so they can learn from what you've done. And use the better answer in the future.

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