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)
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?
Citizen.CreateThread(function()
local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA",true)
local ped = GetPlayerPed(-1)
local bone = GetPedBoneIndex(ped,12844)
AttachCamToPedBone(cam,ped,bone,0.0,0.0,0.65,GetEntityHeading(ped))
SetCamRot(cam, 0.0,0.0,GetEntityHeading(ped))
SetCamFov(cam,90.0)
RenderScriptCams(true,true,1000, 1, 0)
SetCamNearClip(cam, 0.09)
while true do
Citizen.Wait(1)
SetCamRot(cam, 0.0,0.0,GetEntityHeading(ped))
end
end)