Files
rpemotes/client/Ragdoll.lua
AvaN0x fdb9d4e513 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>
2023-01-07 10:23:14 +01:00

26 lines
750 B
Lua

if Config.RagdollEnabled then
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
stop = false
end
while not stop do
SetPedToRagdoll(ped, 1000, 1000, 0, false, false, false)
Wait(0)
end
end
function StopRagdoll()
if Config.RagdollAsToggle then return end
stop = true
end
end