[Release] Handcuff and Handsup scripts


#164

Hm. Maybe I made the raycast capsule to large. I will have to look at that sometime.


#165

Is it possible that people wont move when they are in cuff? Is so, how?


#166

You will need to change the animation flag.

TaskPlayAnim flag argument.


#167

What do i need to change to? And where?


#168

TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 49, 0, 0, 0, 0)

… to …

TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 18, 0, 0, 0, 0)


#169

Ok, Thank you for the help;D


#170

hello my friend… i have change the code on handcuff.lua becuase i need to put cuff to player and the same time this player dont see nothing(black screen)

handcuffed = false
local animation = {dict = "mp_arresting", name = "idle"}
local unarmed = GetHashKey("WEAPON_UNARMED")

RegisterNetEvent("Handcuff")
AddEventHandler("Handcuff", function()
	local player = PlayerId()
	local plyPed = GetPlayerPed(player)
	if DoesEntityExist(plyPed) then
		if IsEntityPlayingAnim(plyPed, animation.dict, animation.name, 3) then
			ClearPedSecondaryTask(plyPed)
			SetEnableHandcuffs(plyPed, false)
			SetEnableHandcuffs(plyPed, false)
			SetCurrentPedWeapon(ped, unarmed, true)
			handcuffed = false
			DoScreenFadeIn(true)--edw ksemavrizi i o8oni
			
		else
			handsup = false
			ClearPedTasksImmediately(plyPed)
			RequestAnimDict(animation.dict)
			while not HasAnimDictLoaded(animation.dict) do
				Citizen.Wait(100)
			end

			TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 49, 0, 0, 0, 0)
			SetEnableHandcuffs(plyPed, true)
			SetCurrentPedWeapon(plyPed, unarmed, true)
						handcuffed = true
			
		end
	end
end)

Citizen.CreateThread(function()
	while true do
		local player = PlayerId()
		local plyPed = GetPlayerPed(player)
		if DoesEntityExist(plyPed) then

			-- Cuffing Logic
			if not IsPedInAnyVehicle(plyPed, false) then
				if IsControlJustPressed(0, 186) then
					local targetped = GetPedInFront()
					print(targetped)
					if targetped ~= 0 then
						local targetplayer = GetPlayerFromPed(targetped)
						if targetedPlayer ~= -1 then
							TriggerServerEvent("CheckHandcuff", GetPlayerServerId(targetplayer))
						end
					end
				end
			end

			-- Backup Handcuffs
			if handcuffed then
				if not IsEntityPlayingAnim(plyPed, animation.dict, animation.name, 3) then
					Citizen.Wait(3000)
					if handcuffed then
						TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 49, 0, 0, 0, 0)
						
					end
				end
			end

			-- Remove ability to drive vehicles
			if handcuffed then
			
			    DisablePlayerFiring(player, true)
				DisableControlAction(0, 25, true)
				DisableControlAction(1, 140, true)
				DisableControlAction(1, 141, true)
				DisableControlAction(1, 142, true)
				DoScreenFadeOut(player, true)		--edw mavrizi i o8oni
				
				
				
				

			SetPedPathCanUseLadders(GetPlayerPed(PlayerId()), false)
				if IsPedInAnyVehicle(GetPlayerPed(PlayerId()), false) then
					DisableControlAction(0, 59, true)
					
					

				end
			end
			
		end
		Citizen.Wait(0)
	end
end)

function GetPedInFront()
	local player = PlayerId()
	local plyPed = GetPlayerPed(player)
	local plyPos = GetEntityCoords(plyPed, false)
	local plyOffset = GetOffsetFromEntityInWorldCoords(plyPed, 0.0, 1.3, 0.0)
	local rayHandle = StartShapeTestCapsule(plyPos.x, plyPos.y, plyPos.z, plyOffset.x, plyOffset.y, plyOffset.z, 1.0, 12, plyPed, 7)
	local _, _, _, _, ped = GetShapeTestResult(rayHandle)
	return ped
end

function GetPlayerFromPed(ped)
	for a = 0, 64 do
		if GetPlayerPed(a) == ped then
			return a
		end
	end
	return -1
end

so he is working perfect…but i need if this guy have cuff i want this guy to press the button ‘F’ to go inside on the car… can help me with this?


#172

So when i cuff them i cant uncuff then after i cuffed them. Help!


#173

Mess with the animation flags like I said before.


#174

Do you know the problem
This is what i have right now:
TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 18, 0, 0, 0, 0)


#175

I really won’t know the issues unless I was to actually look at it. I am not really around enough to look at it so I really couldn’t tell you.


#176

OK, but what do i have to change in TaskPlayAnim(plyPed, animation.dict, animation.name, 8.0, -8, -1, 18, 0, 0, 0, 0)?


#177

Change it back to what it was before man. I really don’t have time to find the flags for you. Do some googling on GTA 5 ped flags.


#178

I have no clue on how to edit the user perms in the config, could you please give me an example?


#179

There is no perms… This script was strictly for educational purposes… This was a script that people are supposed to download and make edits of their own.


#180

Ah 10-4 I’ll work on a perms script, thank you


#181

Hopefully the base code works fine for you and that it integrates to your needs. Have a nice night or day.


#182

great script mah dood


#183

to work this script need to change animation flags from handcuff.lua and handsup.lua ? or only from handcuff.lua file?

Thanks for a help!!


#184

What? The script works fine without changing anything.