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 <xvender7@gmail.com>
This commit is contained in:
AvaN0x
2023-01-07 10:23:14 +01:00
parent cc808269f9
commit fdb9d4e513

View File

@@ -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