From fdb9d4e51350f7edfc5100ae92024eb574b3cabb Mon Sep 17 00:00:00 2001 From: AvaN0x Date: Sat, 7 Jan 2023 10:23:14 +0100 Subject: [PATCH] Update Ragdoll.lua (PR #96) 1. we don't need to loop ped id, it's not going to change while in ragdoll anyway 2. correct IsPedOnFoot check, before changing declarations (wont ragdoll if exiting a vehicle, etc) 3. Wait has to be 0 to prevent sync issues as much as possible 4. supposed to be 3 booleans at the end instead of integers 5. function info is never used 6. RegisterCommand requires 3 arguments Co-authored-by: iSentrie --- client/Ragdoll.lua | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/client/Ragdoll.lua b/client/Ragdoll.lua index 4f2fb53..2a38b6d 100644 --- a/client/Ragdoll.lua +++ b/client/Ragdoll.lua @@ -1,10 +1,12 @@ if Config.RagdollEnabled then - RegisterCommand('+ragdoll', function(source, args, raw) Ragdoll() end) - RegisterCommand('-ragdoll', function(source, args, raw) StopRagdoll() end) + RegisterCommand('+ragdoll', function() Ragdoll() end, false) + RegisterCommand('-ragdoll', function() StopRagdoll() end, false) RegisterKeyMapping("+ragdoll", "Ragdoll your character", "keyboard", Config.RagdollKeybind) local stop = true function Ragdoll() + local ped = PlayerPedId() + if not IsPedOnFoot(ped) then return end if Config.RagdollAsToggle then stop = not stop else @@ -12,11 +14,8 @@ if Config.RagdollEnabled then end while not stop do - local ped = PlayerPedId() - if IsPedOnFoot(ped) then - SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0) - end - Wait(10) + SetPedToRagdoll(ped, 1000, 1000, 0, false, false, false) + Wait(0) end end @@ -24,4 +23,4 @@ if Config.RagdollEnabled then if Config.RagdollAsToggle then return end stop = true end -end +end \ No newline at end of file