citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.43k stars 2.02k forks source link

Ragdolls are not synced with the server (even when not a dead player) #2436

Open mcNuggets1 opened 4 months ago

mcNuggets1 commented 4 months ago

What happened?

Ragdolls become desynced when using SetPedToRagdoll and ResetPedRagdollTimer over a period of lying still or if you move too far away. Notably teleporting ragdolled players makes them twitch a lot and have a wrong position in the end too sometimes.

Shooting a ragdoll also causes it to disappear in some scenarios, but I couldn't reproduce this one, it seems related to the death system of GTA V.

Is there any way to fix this behaviour? It also goes so far that the position of a player is completely different from player to player and the local player of course.

Expected result

Ragdolls that are somewhat networked, atleast the position

Reproduction steps

function CreateRagdollThread() CreateThread(function() -- Ragdolling -- Replace "ESX.PlayerData.ped" with "PlayerPedId()" and it should run fine.

    SetEnableHandcuffs(ESX.PlayerData.ped, true)
    SetEnableBoundAnkles(ESX.PlayerData.ped, true)
    SetPedCanPlayInjuredAnims(ESX.PlayerData.ped, false)

    while true do
        if not IsPedRagdoll(ESX.PlayerData.ped) then
            SetPedToRagdoll(ESX.PlayerData.ped, 1000, 1000, 0, false, false, false)
        else
            ResetPedRagdollTimer(ESX.PlayerData.ped)
        end

        Wait(0)
    end

    SetEnableHandcuffs(ESX.PlayerData.ped, false)
    SetEnableBoundAnkles(ESX.PlayerData.ped, false)
    SetPedCanPlayInjuredAnims(ESX.PlayerData.ped, true)
end)

end

Importancy

Slight inconvenience

Area(s)

FiveM, FXServer, Natives

Specific version(s)

FiveM b2944

Additional information

I tried nearly everything and everything failed and then I went on here.

StuxxyOfficial commented 4 months ago

afaik, this isn't a fivem bug, its part of the games functionality.

mcNuggets1 commented 4 months ago

I do know that. It's not documented at all, atleast document the ragdoll behaviour somewhere or atleast implement a hotfix fixing the position of the ragdolled player for you locally.

StuxxyOfficial commented 4 months ago

Well this is to report bugs within FiveM, feature requests belong on the forums :)