- Documentation
- Server events
- onPlayerClick
Event
onPlayerClick
A player clicked with the mouse while the cursor was visible, outside GUI windows. clickedElement is the clicked element or nil when the world was clicked.
Handler
addEventHandler("onPlayerClick", root, function(mouseButton, buttonState, clickedElement, worldX, worldY, worldZ, screenX, screenY) ... end)Parameters
mouseButtonstring"left","right","middle".buttonStatestring"down"or"up".clickedElementelement- The element or
nil. worldX, worldY, worldZfloat- World point.
screenX, screenYfloat- Screen point.
Source
source is the player.
Example
addEventHandler("onPlayerClick", root, function(button, state, el)
if button == "left" and state == "down" and el and getElementType(el) == "vehicle" then
outputChatBox("Kliknięto " .. getVehicleName(el), source)
end
end)
See also
onElementClickedA player clicked on an element (with the cursor visible).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.