[Release] Ragdoll Script

While on foot, press and hold U to ragdoll (or using a controller, UP on the D-Pad), release to stand back up. This script is meant to replace the ragdoll option on the Enhanced Reborn Trainer as that one is not synced for all players (yet!).

client.lua

 Citizen.CreateThread(function()
 	while true do
 		Citizen.Wait(0)
 		if IsControlPressed(1, 303) then
 		SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
 		end
 	end
 end)

__resource.lua

client_script 'client.lua'

8 Likes

Hello,
where did you got the int for the keys from?

Check out this post https://forum.cfx.re/t/list-of-possible-keys-in-array/1979 . There are also a few natives that could help you discover your own keys if you wanted to. Search natives.lua for CONTROL or INPUT.

2 Likes

Hey, Im wondering this script could be changed up a bit to make it a toggle instead of a press and hold, this would help alot on RP servers.

+1 for this, a toggle function would be perfect :slight_smile:

I’m sure a toggle feature would be possible, but would require a bit more in-depth scripting. I’m still learning so the process is slow. If someone else would like to take my script and make it into a version that toggles, that is fine. Otherwise it may be awhile before I release one.

When the server side version of the trainer comes out, all functions will be synced for all players so then this script will be useless.

Citizen.CreateThread(function()
 	while true do
 		Citizen.Wait(0)
 		if IsControlPressed(2, 303) then
 			ragdol = 1 end
 			if ragdol == 1 then
 		SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
 		end
 	end
 end)
Citizen.CreateThread(function()
 	while true do
 		Citizen.Wait(0)
 		if IsControlPressed(2, 246) then
 			ragdol = 0 end
 			if ragdol == 1 then
 		SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
 		end
 	end
 end)

U - Activate
Y - Deactivate

5 Likes

@xYaroslavGTx Thanks!

Thanks man. Cant wait to try it out

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		if IsPedBeingStunned(GetPlayerPed(-1)) then
		ragdol = 1
		end
	end
end)

Add this and when you are stunned with the taser, you will stay ragdolled

this part of script don’t work for me, the script ragdoll work but no stay ragdoll after tazer

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlPressed(1, 20) then
SetPedToRagdoll(GetPlayerPed(-1), 1000, 1000, 0, 0, 0, 0)
end
end
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsPedBeingStunned(GetPlayerPed(-1)) then
ragdol = 1
end
end
end)

maybe it’s wrong ? can u help me pls ?

how do i download and install???

1 Like

You can try and use this native instead SetPedMinGroundTimeForStungun

Nice option for rp, like ambulance and operations. Maybe someone can include items? Like eat sleeping item, ragdoll. Eat wakeup item or press button Y stand up,

1 Like

You make the resource yourself. Make a folder, make a file in the folder called __resource.lua and another file called client.lua. Take the code from here and put it in the files you just make. Simple.

Would it be possible to make this script come into affect when you get shot, if so, how would you do it?

How do you disable the controller key bind?

where does this go?

any one know how i can make the ragdoll repeat itself every 40 seconds or so because sometimes EMS cant see players so the ragdoll refresh would fix this i just dont know what im doing

Hello.
Nice script!
Can you mayby make a command version?