Nonameman Posted September 1, 2010 Share Posted September 1, 2010 Hey All! I'm a newbie, so sorry if I ask stupid things. In the addEventHandler() command, I don't know what should be the second parameter. I use the wiki to get help, but there's a lot of variations to this params, GetRootElement()/GetLocalPlayer(), What to use in different situations? What is it for? Thanks Nonameman Link to comment
Castillo Posted September 1, 2010 Share Posted September 1, 2010 Hey All!I'm a newbie, so sorry if I ask stupid things. In the addEventHandler() command, I don't know what should be the second parameter. I use the wiki to get help, but there's a lot of variations to this params, GetRootElement()/GetLocalPlayer(), What to use in different situations? What is it for? Thanks Nonameman seriusly, i don't know i ever use getRootElement() Link to comment
Nonameman Posted September 1, 2010 Author Share Posted September 1, 2010 My other problem is if I use outputChatBox () function in a client-side function, without any params after the string, who will the message show to? Link to comment
dzek (varez) Posted September 1, 2010 Share Posted September 1, 2010 client-side scripts are running INDEPENDLY on each client (player) - outputChatBox will output chat to that player who is running that scripts. like (in words) - you are checking for current vehicle speed every second, and if its > 50, you are outputting text - its doing (independly) the same thing on every client, but only client driving faster than 50 will see message. addEventHandler - 2nd parameter is attached element. every event is triggered by something (this is called "source" in handler function). if you are making onMarkerHit - attached element could be one marker, or all markers, example: myMarker = createMarker(arguments, we, dont, care, in_, this, example) otherMarker = createMarker(arguments, we, dont, care, in_, this, example) function myMarkerHandler(element, matchingDimensions) outputChatBox("something hit my marker") end function anyMarkerHandler(element, matchingDimensions) outputChatBox("something hit some marker, it can be ANY marker") if (source==myMarker) then outputChatBox("oh, and it was MY marker") end end addEventHandler("onMarkerHit", myMarker, myMarkerHandler) addEventHandler("onMarkerHit", getRootElement(), anyMarkerHandler) see the difference? try it out Link to comment
Nonameman Posted September 2, 2010 Author Share Posted September 2, 2010 Yes, thanks. 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