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:

client/interactions.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)

esx_policejob

Search the event esx_policejob:handcuff and replace it with:

circle-exclamation

Last updated