OnClientDoubleClick: Difference between revisions
Jump to navigation
Jump to search
m (→See Also) |
|||
(6 intermediate revisions by 5 users not shown) | |||
Line 6: | Line 6: | ||
<syntaxhighlight lang="lua">string button, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld | <syntaxhighlight lang="lua">string button, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* '''button''': This refers the button used to click on the mouse, can be ''left'', ''right'', or ''middle' | * '''button''': This refers the button used to click on the mouse, can be ''left'', ''right'', or ''middle''. | ||
* '''absoluteX''': This refers to the 2D ''x coordinate'' the user clicked on his screen, and is an ''absolute'' position in pixels. | * '''absoluteX''': This refers to the 2D ''x coordinate'' the user clicked on his screen, and is an ''absolute'' position in pixels. | ||
* '''absoluteY''': This refers to the 2D ''y coordinate'' the user clicked on his screen, and is an ''absolute'' position in pixels. | * '''absoluteY''': This refers to the 2D ''y coordinate'' the user clicked on his screen, and is an ''absolute'' position in pixels. | ||
Line 18: | Line 18: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
button | function onMyMouseDoubleClick (button, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) | ||
if button == "left" then | |||
playSoundFrontEnd(40) | |||
end | |||
end | |||
addEventHandler("onClientDoubleClick", root, onMyMouseDoubleClick)</syntaxhighlight> | |||
[[pl:onClientDoubleClick]] | |||
==See Also== | ==See Also== | ||
{{GUI_events}} | {{GUI_events}} | ||
===Client event functions=== | ===Client event functions=== | ||
{{Client_event_functions}} | {{Client_event_functions}} | ||
Latest revision as of 14:28, 20 May 2018
This event triggers whenever the user double-clicks his mouse. This is linked to the GTA world, as appose to GUI for which onClientGUIDoubleClick is to be used. This event allows detection of click positions of the 3D world.
Parameters
string button, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld
- button: This refers the button used to click on the mouse, can be left, right, or middle.
- absoluteX: This refers to the 2D x coordinate the user clicked on his screen, and is an absolute position in pixels.
- absoluteY: This refers to the 2D y coordinate the user clicked on his screen, and is an absolute position in pixels.
- worldX: This represents the 3D x coordinate the player clicked on the screen, and is relative to the GTA world.
- worldY: This represents the 3D y coordinate the player clicked on the screen, and is relative to the GTA world.
- worldZ: This represents the 3D z coordinate the player clicked on the screen, and is relative to the GTA world.
- clickedWorld: This represents any physical entity elements that were clicked. If the player clicked on no MTA element, it's set to false.
Source
The source of this event is the client's root element.
Example
function onMyMouseDoubleClick (button, absoluteX, absoluteY, worldX, worldY, worldZ, clickedWorld) if button == "left" then playSoundFrontEnd(40) end end addEventHandler("onClientDoubleClick", root, onMyMouseDoubleClick)
See Also
Input
GUI
- onClientGUIAccepted
- onClientGUIBlur
- onClientGUIChanged
- onClientGUIClick
- onClientGUIComboBoxAccepted
- onClientGUIDoubleClick
- onClientGUIFocus
- onClientGUIMouseDown
- onClientGUIMouseUp
- onClientGUIMove
- onClientGUIScroll
- onClientGUISize
- onClientGUITabSwitched
- onClientMouseEnter
- onClientMouseLeave
- onClientMouseMove
- onClientMouseWheel
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled