p_policejob

Want to make handsup function work with our Crime Rope and p_policejob? Follow this guide.

1

Replace Files In p_policejob

find directory p_policejob/modules/client/handsup.lua

Replace code inside with this:

local handsUp = false

local function exportHandler(exportName, func)
    AddEventHandler(('__cfx_export_qb-smallresources%s'):format(exportName), function(setCB)
        setCB(func)
    end)
end

RegisterCommand('p_handsup', function()
	if exports['op-crime']:isRopeActive() or LocalPlayer.state.isDead or exports['p_policejob']:isInCuffProcess() or LocalPlayer.state.PhoneOpen then
		return
	end
	
	if handsUp then
		ClearPedSecondaryTask(cache.ped)
		handsUp = false
		return
	end

	if LocalPlayer.state.isCuffed or LocalPlayer.state.PhoneOpen then
		return
	end

	local animDict = lib.requestAnimDict("random@mugging3")
	TaskPlayAnim(cache.ped, animDict, "handsup_standing_base", 2.0, 2.0, -1, 49, true)
	RemoveAnimDict(animDict)
	handsUp = true
	Citizen.CreateThread(function()
		while handsUp do
			Wait(1)
			DisableControlAction(2, 24, true)
			DisableControlAction(2, 257, true)
			DisableControlAction(2, 25, true)
			DisableControlAction(2, 263, true)
			DisableControlAction(2, 45, true)
			DisableControlAction(2, 37, true)
			DisableControlAction(2, 23, true)
			DisableControlAction(0, 47, true)
			DisableControlAction(0, 264, true)
			DisableControlAction(0, 257, true)
			DisableControlAction(0, 140, true)
			DisableControlAction(0, 141, true)
			DisableControlAction(0, 142, true)
			DisableControlAction(0, 143, true)
			if (IsEntityPlayingAnim(cache.ped, "random@mugging3", "handsup_standing_base", 3) ~= 1) then
				handsUp = false
			end
		end
	end)
end)

RegisterKeyMapping('p_handsup', locale('hands_up'), 'keyboard', 'X') -- X

-- compatible with qb-smallresources
exportHandler('getHandsup', function()
	return handsUp
end)
2

Replace files in op-crime

find directory op-crime/integrations/client/utils/handsup.lua

Replace code inside with this:

handsupDictonary = "random@mugging3"
handsupAnimation = "handsup_standing_base"
handsup = false

function hasHandsUp()
    return handsup
end

function isPedDead(Ped)
    return IsPedDeadOrDying(Ped, true)
end

function isRopeActive()
    return isHandcuffed
end
exports("isRopeActive", isRopeActive)

function ToggleHands()
    
end

Last updated