manve1 Posted July 30, 2013 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? Looking for tutorials or information? check out: www.simpleask.co.uk
xXMADEXx Posted July 30, 2013 Posted July 30, 2013 So a script that returns an object when the client clicks? The Ultimate Lua Tutorial! | MTA PHP SDK
manve1 Posted July 30, 2013 Author Posted July 30, 2013 When he clicks on an object that was created client sided Looking for tutorials or information? check out: www.simpleask.co.uk
Vector Posted July 30, 2013 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); there are two kinds of people: those who know C++ and those who don´t. .)
manve1 Posted July 30, 2013 Author 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 Looking for tutorials or information? check out: www.simpleask.co.uk
manve1 Posted July 30, 2013 Author Posted July 30, 2013 Up. Looking for tutorials or information? check out: www.simpleask.co.uk
Castillo Posted July 30, 2013 Posted July 30, 2013 So, it outputs "Fails"? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
manve1 Posted July 31, 2013 Author Posted July 31, 2013 Yes Looking for tutorials or information? check out: www.simpleask.co.uk
Vector Posted July 31, 2013 Posted July 31, 2013 is M4 a valid object? there are two kinds of people: those who know C++ and those who don´t. .)
Castillo Posted July 31, 2013 Posted July 31, 2013 Post the script with the M4 object. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
manve1 Posted July 31, 2013 Author 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); Looking for tutorials or information? check out: www.simpleask.co.uk
iMr.3a[Z]eF Posted July 31, 2013 Posted July 31, 2013 Is "M4" a gun? To Visit Us Press Here: mtasa://5.9.206.180:22002
Castillo Posted July 31, 2013 Posted July 31, 2013 Must be that the object has no collisions. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
manve1 Posted July 31, 2013 Author Posted July 31, 2013 possible to make a collision that would work when clicked on M4? Looking for tutorials or information? check out: www.simpleask.co.uk
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