# onClientCursorMove (Client)

> Fired when the mouse moves.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Client
- **Category**: Keyboard
- **URL**: https://wiki.mymp.gg/en/onClientCursorMove

## Syntax

```lua
addEventHandler("onClientCursorMove", root, function(float cursorX, float cursorY, float absoluteX, float absoluteY, float worldX, worldY, worldZ) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `cursorX` | `float` | Horizontal position relative to the screen, from 0 to 1. |
| `cursorY` | `float` | Vertical position relative to the screen, from 0 to 1. |
| `absoluteX` | `float` | Horizontal position in pixels. |
| `absoluteY` | `float` | Vertical position in pixels. |
| `worldX, worldY, worldZ` | `float` | A world point 300 units ahead of the camera, in that position's direction. |

## Source

The root element (`root`).

While the cursor shows, it fires when the cursor moves to another pixel. While the cursor is hidden, it fires on every mouse movement, and the position is the screen's centre plus how far the mouse moved.

## Example

```lua
addEventHandler("onClientCursorMove", root, function(cx, cy, x, y)
    if isCursorShowing() then
        outputDebugString(("cursor at %.0f, %.0f"):format(x, y))
    end
end)
```

## See also

- [getCursorPosition (Client)](https://wiki.mymp.gg/en/getCursorPosition.md): Reads where the cursor is on the screen and the world point it points at.
- [setCursorPosition (Client)](https://wiki.mymp.gg/en/setCursorPosition.md): Moves the cursor to a point on the screen.
- [showCursor (Client)](https://wiki.mymp.gg/en/showCursor.md): Shows or hides the mouse cursor for this resource.
