mirror of
https://github.com/jimathy/rpemotes.git
synced 2026-08-01 09:48:38 -04:00
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:
@@ -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
|
||||
Reference in New Issue
Block a user