manve1 Posted July 30, 2013 Share Posted July 30, 2013 I looked over search for how to use "onClientClick" for when client clicks on an object that was created and i couldn't find it. So my question is; Could anyone give me an example of how to make it? Link to comment
xXMADEXx Posted July 30, 2013 Share Posted July 30, 2013 So a script that returns an object when the client clicks? Link to comment
manve1 Posted July 30, 2013 Author Share Posted July 30, 2013 When he clicks on an object that was created client sided Link to comment
Vector Posted July 30, 2013 Share Posted July 30, 2013 addEventHandler ("onClientClick", getRootElement (), function (button,state,absoulteX,absoluteY,worldX,worldY,worldZ,elementClicked) if not elementClicked then return end; -- if set to false, there is no element clicled. -- elementClicked is the element clicked by the client. -- do whatever... end); Link to comment
manve1 Posted July 30, 2013 Author Share Posted July 30, 2013 changed your script just a bit and as this event is new to me i would like help on fixing it. addEventHandler ("onClientClick", getRootElement( ), function (button,state,absoulteX,absoluteY,worldX,worldY,worldZ,elementClicked) if elementClicked == M4 then outputChatBox("Works") return end; outputChatBox("Fails.") end); Just so you know, it does contain an object "M4" that was created Link to comment
Castillo Posted July 31, 2013 Share Posted July 31, 2013 Post the script with the M4 object. Link to comment
manve1 Posted July 31, 2013 Author Share Posted July 31, 2013 local M4 = createObject(356, 1934.90002, -2356.69995, 12.8, 90, 0, 0) createBlipAttachedTo( M4, 0, 1, 0, 255, 0 ) addEventHandler ("onClientClick", getRootElement( ), function (button,state,absoulteX,absoluteY,worldX,worldY,worldZ,elementClicked) if elementClicked == M4 then outputChatBox("Works") return end; outputChatBox("Fails.") end); Link to comment
Castillo Posted July 31, 2013 Share Posted July 31, 2013 Must be that the object has no collisions. Link to comment
manve1 Posted July 31, 2013 Author Share Posted July 31, 2013 possible to make a collision that would work when clicked on M4? 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