Scripting Moderators ds1-e Posted January 18, 2019 Scripting Moderators Share Posted January 18, 2019 Hi. I have some questions about things above. As far i understand: getRootElement() it's same as root and getResourceRootElement() it's same as resourceRoot But i don't really understand where i should use getRootElement() / getResourceRootElement(). Can someone explain me about this, would be nice with a 2 examples. Link to comment
MIKI785 Posted January 18, 2019 Share Posted January 18, 2019 (edited) See this: https://wiki.multitheftauto.com/wiki/Element_tree The root element contains every single element present on the server (or each client if used clientside). Resource root element contains every element under that resource, so if the resource creates an object using createObject, it will be contained within the resource root but also within the root element (as that contains all the resources). It's like XML. Edited January 18, 2019 by MIKI785 1 Link to comment
Feche1320 Posted January 18, 2019 Share Posted January 18, 2019 resourceRoot is used only on 'onClientResourceStart' and on 'onResourceStart' If you use root on the events mentioned above, when any resource starts, it will get triggered for all resources, so with resourceRoot it will get only triggered for the resource that you you want to know that it started root is used on any other events, like 'onPlayerJoin' or 'onClientMarkerHit' 1 Link to comment
Discord Moderators Pirulax Posted January 19, 2019 Discord Moderators Share Posted January 19, 2019 What MIKI785 said is correct. In theory you could use resourceRoot to, for example, blow up a vehicle, but only a vehicle that was created by that resource. 1 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