relief Posted August 9, 2013 Share Posted August 9, 2013 Is it possible to separate elements into two nodes so each node has its own events? Link to comment
TrapLord Studios™ Posted August 9, 2013 Share Posted August 9, 2013 It is, just as Crystal Explained above. Link to comment
relief Posted August 10, 2013 Author Share Posted August 10, 2013 Thank you, I'll try that and let you know if it's what I want Link to comment
relief Posted August 10, 2013 Author Share Posted August 10, 2013 Thank you very much, works! Link to comment
relief Posted August 10, 2013 Author Share Posted August 10, 2013 Still attaches the event to all the elements. Can anyone post a simple example on how this is done? To use the event system, you attach event handlers to elements in the element tree using addEventHandler. When you do this, your function will get triggered for all the events triggered on that element, it's parents (and their parents, etc.) and it's children (and their children). As such, an event handler attached to the root element will be triggered when an event occurs for any element. As a consequence you should generally use as specific a handler as you can. If you wish to just see when the player enters a specific marker, just attach the event handler to that marker.Source: https://wiki.multitheftauto.com/wiki/Event_system Link to comment
bandi94 Posted August 10, 2013 Share Posted August 10, 2013 Somthing like this .( Maybe i did something wrong , i never tryed to use Parent Element in EventHandler) group1 = createElement("carGroups1") local veh1 = createVehicle() local veh2 = createVehicle() setElementParent(veh1,groupe1) setElementParent(veh2,groupe1) function entered() outputChatBox("You are in a car from groupe1") end addEventHandler("onVehicleEnter",group1,entered) Link to comment
relief Posted August 10, 2013 Author Share Posted August 10, 2013 Thank you, bandi94. Fixed. 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