[Need help] script for change FOV


#1

Hi ! I want change the FOV of FPS view
I’ve see here https://runtime.fivem.net/doc/reference.html#_0x80C8B1846639BB19

SET_CAM_FOV #
// 0xB13C14F66A00D047 0xD3D5D74F
// SetCamFov
void SET_CAM_FOV(Cam cam, float fieldOfView);
Sets the field of view of the cam.

Min: 1.0f
Max: 130.0f

i’ve try this

local FOVchange = true

– CODE –

Citizen.CreateThread(function()

	while true do
		Wait(1)

		if FOVchange then
			SetCamFov(130)
		      	end
	end
end)

He dont work…

Please help me


#2

The native needs 2 arguments, and you only provided one. Also, a float should be a decimal number, so 130.0, and not just 130.


#3

I’ve try :

SetCamFov(0, 130.0)
SetCamFov(0,130.0f)

SetCamFov(4,130.0)
SetCamFov(4,130.0f)

nothing change FOV…


#4

Try using this for the camera parameter.


#5

I’ve try this but dont work too…

Citizen.CreateThread(function()

while true do
	Wait(1)

	if IsCamActive (4) then
		SetCamFov(4, 130.0)
	      	end
end

end)


#6

I think he was talking about this native:
GetRenderingCam()
not
IsCamActive()


#7

Yes you need to pass the reference of the camera that is currently being used. You can obtain the camera by running GetRenderingCam() as Cheleber said.

You can do something like this:

local camera = GetRenderingCam()
local fov = 120.0

SetCamFov(camera, fov)

#8

@Syntasu I’ve tried this, using First Person Only as a base.

I have

local forceFirstPerson = true
local camera = GetRenderingCam()
local fov = 120.0

-- CODE --
Citizen.CreateThread(function()

	while true do
		Wait(1)

		if forceFirstPerson then
			SetFollowPedCamViewMode(4)
			SetCamFov(camera, fov)
		      	end
	end
end)

The camera stays as first person, however the FOV doesn’t change from the default.
Any ideas?

Edit
I am able to create a new camera and change the FOV of it however altering the FOV of cam when

local cam = GetRenderingCam()

Doesn’t do anything, does GetRenderingCam work in this way or not?


#9

could someone just make it as a mod and put it up for download?


#10

@NadroJ There was an fov.asi that NTA compiled over a year ago from the .dll mod, it doesn’t work anymore though.

fov.asi (133 KB)