Fabioxps Posted March 22, 2018 Share Posted March 22, 2018 it is possible to define this parent setElementParent(player,resourceRoot) --server addCommandHandler("a",function() for id, element in pairs(getElementChildren(resourceRoot)) do outputChatBox(type(element))-- not return end end) Link to comment
WorthlessCynomys Posted March 22, 2018 Share Posted March 22, 2018 I don't know if it is possible, but why would you have to do that? 1 Link to comment
Fabioxps Posted March 22, 2018 Author Share Posted March 22, 2018 (edited) when I use an Event trigger this player will also receive this call I do not want to create a new element and I also do not want to use a loop to get players Edited March 22, 2018 by Fabioxps Link to comment
WorthlessCynomys Posted March 22, 2018 Share Posted March 22, 2018 As I know, players are children of root and resourceRoot(not sure about this second) by default. 1 Link to comment
Fabioxps Posted March 22, 2018 Author Share Posted March 22, 2018 (edited) resourceRoot retorna apenas recursos root retorna todos Edited March 22, 2018 by Fabioxps Link to comment
Saml1er Posted March 22, 2018 Share Posted March 22, 2018 I would strongly suggest you to avoid using that. Instead, you can create a dummy element and set it as parent for players that you wish to retrieve later using getElementChildren. local moderatorElement = createElement( "moderator", "admin" ) if moderatorElement then for _, v in pairs ( getElementsByType ( "player" ) ) do setElementParent ( v, moderatorElement ) end end addCommandHandler("a", function() for id, element in pairs ( getElementChildren ( moderatorElement ) ) do outputChatBox ( type ( element ) ) end end ) 1 Link to comment
ZL|LuCaS Posted March 23, 2018 Share Posted March 23, 2018 good optimization good work. You should already know that you can not set this parent 1 Link to comment
Fabioxps Posted March 23, 2018 Author Share Posted March 23, 2018 thank you all and zl | Lucas thanks for understanding what I want to do 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