GrainHHH Posted July 16, 2019 Share Posted July 16, 2019 lets pick up the addEventHandler function. I've read all that crap that wiki offers me about element tree and other related thing but i still can't really understand when i need to use, lets say, the root or the rootElement. i understand that if i want to create a guiWindow that will pop up when player connects my server i need to do smt like --> addEvenHandler("onPlayerJoin", root, function() end) but i have no idea what root really makes and why i use it beside the fact that this event fires up when player connects. so, please, if you really understand it, help me) thank yoy in advance, Link to comment
HassoN Posted July 16, 2019 Share Posted July 16, 2019 (edited) Taking your example of addEvenHandler("onPlayerJoin", root, function() It will trigger whenever a player connects because you used 'root'. But if you for example replace root with a specific player it only trigger when THAT player connects. An example: addEventHandler("onPlayerJoin", getPlayerFromName("HassoN"), function() outputChatBox("HASSON IS HERE", root) end) The outputChatBox will only be triggered if a player called HassoN joins. Got it? Edited July 16, 2019 by HassoN Link to comment
Rockyz Posted July 16, 2019 Share Posted July 16, 2019 36 minutes ago, HassoN said: Taking your example of addEvenHandler("onPlayerJoin", root, function() It will trigger whenever a player connects because you used 'root'. But if you for example replace root with a specific player it only trigger when THAT player connects. An example: addEventHandler("onPlayerJoin", getPlayerFromName("HassoN"), function() outputChatBox("HASSON IS HERE", root) end) The outputChatBox will only be triggered if a player called HassoN joins. Got it? Your example is wrong 1 Link to comment
HassoN Posted July 16, 2019 Share Posted July 16, 2019 17 minutes ago, #,xiRocKyz said: Your example is wrong Ugh yea that's true. I've tried it with onPlayerChat and it worked so I thought it could work with onPlayerJoin as well. Thanks for the correction tho 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