Piorun Posted March 19, 2011 Share Posted March 19, 2011 I have this code: function tworzeniePickupa () sx,sy,wx,wy,wz = getCursorPosition" class="kw4">getCursorPosition() outputChatBox(wx.." "..wy.." "..wz) end addEventHandler ( "onClientClick", getRootElement(), tworzeniePickupa ) Everything is cool, but this code send me 2 messeges (outputChatBox) with coords of GTA world. Please, help Link to comment
Castillo Posted March 20, 2011 Share Posted March 20, 2011 I don't understand what do you want to do, could you put your script in English language firstly? and then explain again what do you want to do. Link to comment
Moderators Citizen Posted March 20, 2011 Moderators Share Posted March 20, 2011 Maybe in your meta.xml, yourScript.lua is loaded 2 times or there are 2 times the function tworzeniePickupa in your code. Why get the position of the cursor again because this event send this parameters ( button, state, absoluteX, absoluteY, wx, wy, wz, clickedElement ): function tworzeniePickupa ( button, state, absoluteX, absoluteY, wx, wy, wz, clickedElement ) outputChatBox(wx.." "..wy.." "..wz) end addEventHandler ( "onClientClick", getRootElement(), tworzeniePickupa ) Link to comment
Piorun Posted March 20, 2011 Author Share Posted March 20, 2011 @citizen - it doesn't work -.- Link to comment
vEnom.sk Posted March 20, 2011 Share Posted March 20, 2011 onCLientClick is triggered when the mouse button is pressed down and again when it is released, that's why you recevie 2 messages. Link to comment
Callum Posted March 20, 2011 Share Posted March 20, 2011 function tworzeniePickupa ( button, state, absoluteX, absoluteY, wx, wy, wz, clickedElement ) if state == "down" then outputChatBox(wx.." "..wy.." "..wz) end end addEventHandler ( "onClientClick", getRootElement(), tworzeniePickupa ) 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