ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Server events
  3. onPlayerClick

Event

onPlayerClick

ServerInput and controlsIdentical to MTA:SA

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