So here’s a script that … toggles Ragdoll obviously.
There are 2 versions
One of them require you to type /rag in chat to toggle the script
The other can be toggled by pressing the key (U)
DOWNLOAD
Ragdoll Toggle via key “U”
Ragdoll Toggle via cmd “/rag”
OR
_resource.lua
-- Toggle Ragdoll written by JAF
-- Made for www.lacountyrp.com
-- Version 1.0.0
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'
-- Add a client script
client_script 'client.lua'
(Toggle Via Key “U”)
client.lua
local ragdoll = false
function setRagdoll(flag)
ragdoll = flag
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if ragdoll then
SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
end
end
end)
ragdol = true
RegisterNetEvent("Ragdoll")
AddEventHandler("Ragdoll", function()
if ( ragdol ) then
setRagdoll(true)
ragdol = false
else
setRagdoll(false)
ragdol = true
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(100)
if ( IsControlPressed(2, 303) ) then --change key here
TriggerEvent("Ragdoll", source)
end
end
end)
(Toggle via command “/rag”)
client.lua
local ragdoll = false
function setRagdoll(flag)
ragdoll = flag
end
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if ragdoll then
SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
end
end
end)
ragdol = true
RegisterNetEvent("Ragdoll")
AddEventHandler("Ragdoll", function()
if ( ragdol ) then
setRagdoll(true)
ragdol = false
else
setRagdoll(false)
ragdol = true
end
end)
RegisterCommand("rag", function(source, args, raw) --change command here
TriggerEvent("Ragdoll")
end, false) --False, allow everyone to run it(thnx @Havoc)
Enjoy!