Skip to content

Commit

Permalink
Update client.lua
Browse files Browse the repository at this point in the history
Fixed a script error caused by a call to a non-existent function (`SetRagdollFlag`) in the `Euphoria.SetBoneProperties` function. The function has been updated to remove this call, which resolves the error.
  • Loading branch information
RaccoonWX authored Apr 11, 2023
1 parent a4a3d18 commit cc7d653
Showing 1 changed file with 52 additions and 40 deletions.
92 changes: 52 additions & 40 deletions client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit cc7d653

Please sign in to comment.