Disable scroll wheel weapon change

Hello, I have been trying to create a script to disable the mouse scroll wheel to change/pullout weapons. I have disabled it while in a vehicle but I can not figure out how to disable it on foot. Thanks for any help. Also very new to coding so sorry if this looks terrible.

client.lua
if IsPedInAnyVehicle(PlayerPedId(), false) then
DisableControlAction(2, 261, true)
DisableControlAction(2, 262, true)
–DisableInputGroup(2)
end

if IsPedInAnyVehicle(PlayerPedId(), false) then
DisableControlAction(0, 261, true)
DisableControlAction(0, 262, true)
DisableInputGroup(24)
end

If you post the code you have so far, that will help others help you :+1:

Alright sorry I didn’t post it. Thanks for the tip.

This should disable it no matter what. i think it needs to be in a loop i could be wrong and you could just make a var and disable once you set it true.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(10)
        DisableControlAction(0, 261, true)
        DisableControlAction(0, 262, true)
        DisableInputGroup(24)
    end
end
2 Likes

Alright I tried what you have said, It doesn’t disable them either. I’m not sure what you mean by make it a “var”. Thanks for the help!

hmm maybe try throwing this in there.

HideHudComponentThisFrame(19)

1 Like

and if its eating alot of ms you could probably do this

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if IsControlJustPressed(0, 37) then
            HideHudComponentThisFrame(19)
        end
    end
end

Okay, thanks again! If i start to notice it using a lot I’ll change it.

yep np

Okay I didn’t realize my weapons got removed after the first test, I said that worked but it doesn’t. I’m very sorry for my stupid mistake.

are you sure it removes your weapons? it shouldn’t nothing there to remove them.

It wasn’t the script that removed them I did. I was testing something else and I forgot to add them back.

okay so it did work then?

No. Once I got weapons back I could still switch with the middle mouse.

probably would have to disable middle mouse as a button.