[Question] How to get cursor position

hello guys , i’m looking for a way to get the cursor position like this MTA:SA function called
getCursorPosition gives

  • cursorX: the relative X coordinate of the mouse cursor. 0 = left side of the screen, 1 = right side.
  • cursorY: the relative Y coordinate of the mouse cursor. 0 = top of the screen, 1 = bottom.
  • absoluteX: the X coordinate of the mouse cursor, in pixels, measured from the left side of the screen.
  • absoluteY: the Y coordinate of the mouse cursor, in pixels, measured from the top of the screen.
  • worldX, worldY, worldZ: the 3D in-game world coordinates that the cursor is pointing at.

so my question is how can i get those parameters in fivem ?

You can get the mouse position from GetControlNormal, see Controls - Cfx.re Docs

local x = GetControlNormal(0, 239)
local y = GetControlNormal(0, 240)

for the worldXYZ coordinates you probably will have to do the screen to world maths yourself.