> For the complete documentation index, see [llms.txt](https://docs.av-scripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.av-scripts.com/laptop-pack/gangs/territories/police-presence.md).

# Police Presence

> This is just an **EXAMPLE** on how to trigger the **remove zone XP** from a gang member that gets arrested by a cop. Please refrain from asking for assistance on how to apply this to a specific script, as I do not have access to every FiveM script.

### qb-policejob

> Search the event **police:client:GetCuffed** and replace it with:

{% code title="client/interactions.lua" %}

```lua
local canRemove = true
RegisterNetEvent('police:client:GetCuffed', function(playerId, isSoftcuff)
    local ped = PlayerPedId()
    if not isHandcuffed then
        isHandcuffed = true
        TriggerServerEvent('police:server:SetHandcuffStatus', true)
        ClearPedTasksImmediately(ped)
        if GetSelectedPedWeapon(ped) ~= `WEAPON_UNARMED` then
            SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true)
        end
        if not isSoftcuff then
            cuffType = 16
            GetCuffedAnimation(playerId)
            QBCore.Functions.Notify(Lang:t('info.cuff'), 'primary')
        else
            cuffType = 49
            GetCuffedAnimation(playerId)
            QBCore.Functions.Notify(Lang:t('info.cuffed_walk'), 'primary')
        end
        -- av_gangs code
        if canRemove then
            canRemove = false
            exports['av_gangs']:removeZoneXP(5) -- 5 is the amount of XP to remove
            -- add a cooldown to prevent cops from abusing this
            CreateThread(function()
                Wait(5000) -- 5 seconds should be enough
                canRemove = true
            end)
        end
    else
        isHandcuffed = false
        isEscorted = false
        TriggerEvent('hospital:client:isEscorted', isEscorted)
        DetachEntity(ped, true, false)
        TriggerServerEvent('police:server:SetHandcuffStatus', false)
        ClearPedTasksImmediately(ped)
        TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Uncuff', 0.2)
        QBCore.Functions.Notify(Lang:t('success.uncuffed'), 'success')
    end
end)
```

{% endcode %}

### esx\_policejob

> Search the event **esx\_policejob:handcuff** and replace it with:

{% code title="client/main.lua" %}

```lua
local canRemove = true
RegisterNetEvent('esx_policejob:handcuff')
AddEventHandler('esx_policejob:handcuff', function()
	isHandcuffed = not isHandcuffed
	local playerPed = PlayerPedId()

	if isHandcuffed then
		RequestAnimDict('mp_arresting')
		while not HasAnimDictLoaded('mp_arresting') do
			Wait(100)
		end

		TaskPlayAnim(playerPed, 'mp_arresting', 'idle', 8.0, -8, -1, 49, 0, 0, 0, 0)
		RemoveAnimDict('mp_arresting')

		SetEnableHandcuffs(playerPed, true)
		DisablePlayerFiring(playerPed, true)
		SetCurrentPedWeapon(playerPed, `WEAPON_UNARMED`, true) -- unarm player
		SetPedCanPlayGestureAnims(playerPed, false)
		FreezeEntityPosition(playerPed, true)
		DisplayRadar(false)
		-- av_gangs code
	        if canRemove then
	            canRemove = false
	            exports['av_gangs']:removeZoneXP(5) -- 5 is the amount of XP to remove
	            -- add a cooldown to prevent cops from abusing this
	            CreateThread(function()
	                Wait(5000) -- 5 seconds should be enough
	                canRemove = true
	            end)
	        end
		if Config.EnableHandcuffTimer then
			if handcuffTimer.active then
				ESX.ClearTimeout(handcuffTimer.task)
			end

			StartHandcuffTimer()
		end
	else
		if Config.EnableHandcuffTimer and handcuffTimer.active then
			ESX.ClearTimeout(handcuffTimer.task)
		end

		ClearPedSecondaryTask(playerPed)
		SetEnableHandcuffs(playerPed, false)
		DisablePlayerFiring(playerPed, false)
		SetPedCanPlayGestureAnims(playerPed, true)
		FreezeEntityPosition(playerPed, false)
		DisplayRadar(true)
	end
end)
```

{% endcode %}

{% hint style="warning" %}
This snippets were taken directly from the official Frameworks Github, if this breaks anything in your server then is on YOU to fix it, this snippets are just examples.
{% endhint %}
