FiveM Show the cursor while walking without controlling the camera

Fivem X-Menu cursor issue

Hey there,
I want do develop a X-Menu where you can do stuff like locking a car or showing your id card. This X-Menu is very important on our server. We do have a working one, but it is not what we want, so we decided to make our own custom one.

What is our problem with this?

When I press X to open it up it comes in the backround. The cursor is where it gets difficult.
If I show the cursor (SetNuiFocus(false, true) it shows up, but he also keeps controlling the camera of the player. To understand what I mean → Please watch the video linked down below!

X-Menu not doing what we want but phone is

If you watched the video, you probably can see the point. In the first part of the video you can see the menu while the cursor is shown and the camera still controlled by the cursor. In the second part you can see our phone (high_phone made by High-Scripts).
When I show the phone the cursor doesn’t control the camera. This is what I want

For us it is really important to walk while having the menu open, like on the phone too.
It should be like the weapon wheel (when you press tab), but with other actions and the cursor shown

Here is how we display the menu:

Citizen.CreateThread(function()
    local MenuOpened = 1
    local lastMenuOpened = 1
    local keybindControl = 73
    
    while true do
        Citizen.Wait(0)
        MenuOpened = IsControlPressed(1, keybindControl)
        if MenuOpened ~= lastMenuOpened then
            lastMenuOpened = MenuOpened
            if MenuOpened then
                SendNUIMessage({
                    action = "show",
                })
                SetCursorLocation(0.5, 0.5)
                SetNuiFocus(false, true)
            else
                SendNUIMessage({
                    action = "hide",
                })
                SetNuiFocus(false, false)
            end
        end
    end
end)

If you read this post, thank you so far. If you know what I need to do or you have any idea to solve this please let me know. I am out of ideas…

DisableControlAction(0, 239, 1) and DisableControlAction(0, 240, 1) should disable mouse input X and Y, I’ve used it for a while and it seems like that might help you. Just have to loop them while the menu is open.

I also thaught so, but then the camera does further move while the menu is visible…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.