- Documentation
- Client events
- onClientClick
Event
onClientClick
The player clicked the mouse with the cursor visible (outside GUI windows).
Handler
addEventHandler("onClientClick", root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) ... end)Parameters
buttonstring"left","right","middle".statestring"down"or"up".absoluteXint- Screen X.
absoluteYint- Screen Y.
worldX, worldY, worldZfloat- World point.
clickedElementelement- The clicked element or
nil.
Source
source is root.
Example
addEventHandler("onClientClick", root, function(button, state, x, y, wx, wy, wz, el)
if state == "down" and el then outputChatBox("Kliknięto " .. getElementType(el)) end
end)
See also
showCursorShows or hides the mouse cursor. The cursor stays visible while at least one resource wants it, so hiding it in one resource does not close another's cursor. By default, while the cursor is shown, the ped controls are blocked.onPlayerClickA player clicked with the mouse while the cursor was visible, outside GUI windows.clickedElementis the clicked element ornilwhen the world was clicked.