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?
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)