diff --git a/client/client.lua b/client/client.lua index 6fae203..7065c10 100644 --- a/client/client.lua +++ b/client/client.lua @@ -3,7 +3,6 @@ local Euphoria = {} function Euphoria.SetBoneProperties(ped, bone, strength, damping, inertia, elasticity, dampingFree) SetPedRagdollOnCollision(ped, true) SetPedRagdollForceFall(ped) - SetRagdollFlag(ped, 1, true) SetRagdollDamping(ped, damping) SetRagdollForce(ped, 1.0) @@ -71,47 +70,60 @@ Citizen.CreateThread(function() end for _, ped in ipairs(pedTable) do - if IsPedRagdoll(ped) then - local netID = PedToNet(ped) - TriggerServerEvent("realistic_ragdoll:applyRagdoll", netID) - elseif IsPedHitByVehicle(ped) then - local vehicle = GetVehiclePedIsIn(ped, true) - if not IsEntityPlayingAnim(ped, animDict, animName, 3) then - MakePedGrabVehicle(ped, vehicle) - grabStartTime = GetGameTimer() + if IsPedR + Citizen.CreateThread(function() + while true do + Citizen.Wait(100) -- Too many players getting 'Reliable network overflow'? Increase the wait time to fix this. + local playerPed = GetPlayerPed(-1) + local pedTable = {} + for ped in EnumeratePeds() do + if not IsPedAPlayer(ped) then + table.insert(pedTable, ped) + end end - end - end - - for i = 0, 255 do - if NetworkIsPlayerActive(i) then - local player = GetPlayerPed(i) - if IsPedRagdoll(player) then - local netID = PedToNet(player) - TriggerServerEvent("realistic_ragdoll:applyRagdoll", netID) - elseif IsPedHitByVehicle(player) then - local vehicle = GetVehiclePedIsIn(player, true) - if not IsEntityPlayingAnim(player, animDict, animName, 3) then - MakePedGrabVehicle(player, vehicle) - grabStartTime = GetGameTimer() + + for _, ped in ipairs(pedTable) do + if IsPedRagdoll(ped) then + local netID = PedToNet(ped) + TriggerServerEvent("realistic_ragdoll:applyRagdoll", netID) + elseif IsPedHitByVehicle(ped) then + local vehicle = GetVehiclePedIsIn(ped, true) + if not IsEntityPlayingAnim(ped, animDict, animName, 3) then + MakePedGrabVehicle(ped, vehicle) + grabStartTime = GetGameTimer() + end end end - end - end - - if grabStartTime ~= nil then - local elapsedTime = GetGameTimer() - grabStartTime - local ped = GetPlayerPed(-1) - local vehicle = GetVehiclePedIsIn(ped, false) - - if vehicle ~= 0 and vehicle ~= nil then - local speed = GetEntitySpeed(vehicle) * 3.6 - - if elapsedTime > 5000 or speed < 2.0 then - ClearPedTasks(ped) - grabStartTime = nil + + for i = 0, 255 do + if NetworkIsPlayerActive(i) then + local player = GetPlayerPed(i) + if IsPedRagdoll(player) then + local netID = PedToNet(player) + TriggerServerEvent("realistic_ragdoll:applyRagdoll", netID) + elseif IsPedHitByVehicle(player) then + local vehicle = GetVehiclePedIsIn(player, true) + if not IsEntityPlayingAnim(player, animDict, animName, 3) then + MakePedGrabVehicle(player, vehicle) + grabStartTime = GetGameTimer() + end + end + end + end + + if grabStartTime ~= nil then + local elapsedTime = GetGameTimer() - grabStartTime + local ped = GetPlayerPed(-1) + local vehicle = GetVehiclePedIsIn(ped, false) + + if vehicle ~= 0 and vehicle ~= nil then + local speed = GetEntitySpeed(vehicle) * 3.6 + + if elapsedTime > 5000 or speed < 2.0 then + ClearPedTasks(ped) + grabStartTime = nil + end + end end end - end - end -end) + end)