How to Disable Afk cam

Hey its pretty simple.

just find a Client.lua in any script and paste that:

Citizen.CreateThread(function()
    while true do 
        Citizen.Wait(100)
        DisableIdleCamera(true)
    end
end)

at the very bottom and you are done.

Thank you @AvaN0x for reminding me that it doesnt need to be called every 100ms you can set the value higher or else

6 Likes

This do not even need to be called each 100ms. From what I tested you can call it once and it is done. :wink:

2 Likes

oh yeah i forgot to add that i just put in the 100 as a random number :smiley:

1 Like

No, I think you are still confused.
It doesn’t need to be in an infinite loop at all.
The wait time doesn’t matter. It shouldn’t be in a loop.
This is bad:

Citizen.CreateThread(function()
    while true do 
        Citizen.Wait(100)
        DisableIdleCamera(true)
    end
end)

All you need is;

DisableIdleCamera(true)
2 Likes

well it wasnt working always for me like that somehow. sometimes it did sometimes it didnt.
so i made it in a loop

1 Like

That’s strange because it should work fine, maybe you have another script that changes it ?

1 Like

thanks for thin information

1 Like

If you disable it on the server, it disables it for everyone. That native that you’re talking about, DisableIdleCamera(true) must be new as when @kibukj and I made my resource, I don’t believe it was there.

We went with the approach that maybe you want to turn it back on, or perhaps you personally want it off but I want it on, so we implemented KVP. You can take a look at it here if you’re interested?

1 Like

I did install your script the idle camera still come back after 30 sec

Id suggest using this resource instead.