Jump to content

MTA FOV Adjustment Without Running


Recommended Posts

Hey, I’m making a system in MTA inspired by GTA 5, where you can adjust the FOV with the scroll. But the setCameraFieldOfView function only works when the player is running. Is there a way to bypass that and adjust it freely, without having to run?

Just now, freitasfn_ said:

Olá, estou fazendo um sistema no MTA inspirado no GTA 5, onde você pode ajustar o FOV com o scroll. Mas a função setCameraFieldOfView só funciona quando o player está rodando. Existe uma maneira de contornar isso e ajustá-lo livremente, sem precisar correr?

CODE:

 

local minFOV, defaultFOV, zoomedFOV = 50, 70, 60

addEventHandler('onClientKey', root, function(button, press)
    if press and getControlState("aim_weapon") then
        local change = (button == 'mouse_wheel_up' and 5) or (button == 'mouse_wheel_down' and -5) or 0
        if change ~= 0 then
            local currentFOV = getCameraFieldOfView("player") + change
            if currentFOV < minFOV then
                currentFOV = minFOV
            elseif currentFOV > defaultFOV then
                currentFOV = defaultFOV
            end
            setCameraFieldOfView("player", currentFOV)
        end
    end
end)

addEventHandler("onClientRender", root, function()
    if not getControlState("aim_weapon") then
        setCameraFieldOfView("player", defaultFOV)
    end
end)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...