Nonameman Posted September 1, 2010 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
Castillo Posted September 1, 2010 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() San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Nonameman Posted September 1, 2010 Author 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?
dzek (varez) Posted September 1, 2010 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 Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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