Jump to content

Can anybody help me to understand THE FU***NG element tree


GrainHHH

Recommended Posts

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

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 by HassoN
Link to comment
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

  • Like 1
Link to comment

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