Locking Ped Camera View Mode Problems

Hello, I am trying to simply lock the camera zoom to the close cam. However, my code only seems to work when changing the camera to first person and not the other levels of zoom as well.

Citizen.CreateThread(function()
	while true do
		Wait(1)
		if GetFollowPedCamViewMode() == 1 or GetFollowPedCamViewMode() == 2 then
			SetFollowPedCamViewMode(0)
		end
	end
end)

Note: View mode 0 is third person close, 1 is third medium, 2 is third far, and 4 is first person

Anyone have any ideas why this isn’t working? Does GTA just not update what the view mode is besides first person and third person?
I’ve also tried doing the opposite and changing the view mode when it was not 0 or 4.

Do you want to force firstperson view?

Unfortunately I do not, forcing first person view or third person view works fine.
I just want to force the camera to be in the close view mode when in third person.

It’s very strange because something like this works to keep it out of first person:

while true do
	Wait(1)
	if GetFollowPedCamViewMode() == 4 then
		SetFollowPedCamViewMode(0)
	end
end

but using the same exact code but replacing the 4 with 1 or 2 just does nothing.

while true do
	Wait(1)
        local pedCam = GetFollowPedCamViewMode(GetPlayerPed(-1))
	if GetFollowPedCamViewMode(pedCam) == 4 then
		SetFollowPedCamViewMode(0)
	end
end

Something like this?

Well that code works for keeping it out of first person view, but third person view has three different zoom levels. What I am trying to do is keep it out of two of the zoom levels, however when you change the 4 to 1 or 2, which are the third person zoom levels, the code essentially does nothing.

local fpsnowpg = false

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        if fpsnowpg then
            bakisdegis(4)
        else
            bakisdegis(0)
        end
        if IsControlJustReleased(0, 0) then
            if fpsnowpg then
                bakisdegis(4)
                fpsnowpg = false
            else
                bakisdegis(0)
                fpsnowpg = true
            end
        end
        
    end
end)

function bakisdegis(value)
    SetFollowPedCamViewMode(value)
end
1 Like

Works great!!! THANK YOU

How would i implement the same for inside a vehicle as you can still swap between the 4 views and it forces first person when getting out

    if not IsPedSittingInAnyVehicle(PlayerPedId()) then
        bakisdegis(4)
        fpsnowpg = true
    end
1 Like

Thank you!!

Hi! Is there a way to do this also when you are mounted on a vehicle? I would be grateful

if IsControlJustReleased(0, 0) and IsPedSittingInAnyVehicle(PlayerPedId()) then
            if fpsnowpg then
                bakisdegis(4)
                fpsnowpg = false
            else
                bakisdegis(0)
                fpsnowpg = true
            end
        end

where to put this line pleas