Allow player to rotate camera when dead

Hello,
so my question is simple:
How could i make it so dead players can rotate their camera?

I though it would be easy when i saw this in esx_ambulancejob client code:
DisableAllControlActions(0)

But sadly even when i remove this and enable all control actions, player still can not move/rotate camera.

Any idea on how to do this?
Thanks!

1 Like

Not sure but it seems like the not moving mouse is more like a game mechanic when you are dead

same issue here. not sure where to enable panning but nothing is working

Yeah, i tried a lot of things, none of which seem to work

Same here too.

I added the esx_ambulancejob script.

And during my testing, I added these two lines:

EnableControlAction(0, 1, true)
EnableControlAction(0, 2, true)

I added them to the IsDead check, where it disables your controls when you die.
As well as to the use item functionality, since it seems to be disabling your controls when applying a bandage or medkit.

Those two lines will re-enable the camera for when using the items.
But not when you’re dead.

So I’m starting to think this may be a deeper game related thing? And not related to any script? Or like a core script or something?

2 Likes

To allow a player to rotate the camera when dead you need to revive the player then force them to either play an animation or ragdoll so that they look like they are “dead” and make them invincible so they cannot get killed again while being “dead”

2 Likes

What animation do you recommend

By default, in FiveM, dead players are not able to rotate their camera. However, you can modify the game’s behavior to allow dead players to rotate their camera by adding a small piece of code to your FiveM server script.

Here’s an example of how you could modify the camera behavior for dead players in your FiveM server script:

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        local playerPed = GetPlayerPed(-1)
        if IsEntityDead(playerPed) then
            SetFollowPedCamViewMode(4)
        end
    end
end)

This code creates a new thread that runs continuously while the game is running. Inside the thread, it checks whether the player’s character is dead by calling the IsEntityDead function. If the player is dead, the camera’s follow mode is set to mode 4, which allows the player to rotate their camera freely.

To use this code in your own FiveM server, simply add it to your server script and restart your server. Note that this modification may affect the gameplay balance and may need to be adjusted depending on your server’s rules and gameplay mechanics.