Disabling smg shooting in a vehicle

Im trying to disable smg shooting in a vehicle as driver and passenger, idk if someone can help me:

Util.Tick(function()

--shoot smg tinchis

local weapon = 736523883

local ped=GetPlayerPed(-1)

if IsPedInAnyVehicle(ped,true) then

    if GetCurrentPedWeapon(ped, weapon, false) then

        haveWeapon = true

        if haveWeapon then

            local canshoot=false

            wait(100000)

        end

    end

end

You can’t shoot a smg in a normal vehicle anyway but that’s the code:

local weapon = 736523883

CreateThread (function()
    local ped = GetPlayerPed(-1)
    local canshoot = true

    if IsPedInAnyVehicle(ped) then
        if GetCurrentPedWeapon(ped, weapon, false) then
           canshoot = false 
        end
    end

    SetPlayerCanDoDriveBy(PlayerID(), canshoot)
    wait(1000)
end)