M MY Multiplayer: Wiki
Side
Kind

getCursorPosition

Client

Reads where the cursor is on the screen and the world point it points at.

float|false getCursorPosition()

Returns

Five numbers: x, y relative to the screen, from 0 to 1, and x, y, z of a world point 300 units ahead of the camera, in the cursor's direction. false when the cursor is not free on the screen.

Example

addEventHandler("onClientRender", root, function()
    local x, y = getCursorPosition()
    if x then
        dxDrawText(("%.2f, %.2f"):format(x, y), 20, 20)
    end
end)

See also