ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getCursorPosition

Function

getCursorPosition

Returns the cursor position as a fraction of the screen 0-1 (x, y). Works only while the cursor is shown. The next three results (a world point) are zeros for now; getWorldFromScreenPosition gives the world point under the cursor.

Syntax

float, float, float, float, float getCursorPosition()

Differences from MTA:SA

  • In MTA:SA this function is server-side only.

In MTA:SA

getCursorPosition()

Returns

x, y (0-1) and three zeros, or false.

Example

addEventHandler("onClientClick", root, function(button, state)
    local x, y = getCursorPosition()
    if x then outputChatBox(("Klik: %.2f, %.2f"):format(x, y)) end
end)

See also