> For the complete documentation index, see [llms.txt](https://crystal-studios.gitbook.io/crystal-studios-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://crystal-studios.gitbook.io/crystal-studios-docs/vehicle-keys/configuration/cl_utils.md).

# cl\_utils

Our script is designed with flexibility in mind. If you are using custom notify, progress bar, police alert, or logging systems, you can easily bridge them using the cl\_utils.lua file. Below you will

***

### 💬 1. Custom Notifications

If you set `Config.NotifySystem = "custom"` in your `config.lua`, you must define how your custom notification system is triggered inside the `SendNotify` function.

```lua
function SendNotify(text, type, length)
    if type == nil then type = "info" end
    if length == nil then length = 5000 end

    if Config.NotifySystem == "auto" then
        Core.Notify(text, type, length)
    elseif Config.NotifySystem == "ox" then
        lib.notify({
            title = type,
            description = text,
            duration = length,
            type = type
        })
    elseif Config.NotifySystem == "custom" then
        -- INSERT YOUR CUSTOM EXPORT / EVENT HERE
        exports['my_notify']:Send(type, text, length)
    end
end
```

### ⏳ 2. Custom Progress Bar - Start

If you set `Config.ProgressbarSystem = "custom"`, you can integrate your own progress bar.

> ⚠️ IMPORTANT: You must always return the callback `cb(true)` upon successful completion or `cb(false)` if the player cancels the action. Otherwise, the script's actions (like lockpicking) will never finish!

```lua
function StartProgressBar(name, label, duration, disables, cb)
    if Config.ProgressbarSystem == "auto" then
        -- [Default Auto System]
        
    elseif Config.ProgressbarSystem == "ox" then
        -- [Default Ox System]

    elseif Config.ProgressbarSystem == "custom" then
        -- EXAMPLE INTEGRATION (e.g., using 'mythic_progbar'):
        exports['mythic_progbar']:Progress({
            name = name,
            duration = duration,
            label = label,
            useWhileDead = false,
            canCancel = true,
            controlDisables = {
                disableMovement = disables.disableMovement or false,
                disableCarMovement = disables.disableCarMovement or false,
                disableMouse = disables.disableMouse or false,
                disableCombat = disables.disableCombat or false,
            }
        }, function(status)
            if not status then
                if cb then cb(true) end -- Success
            else
                if cb then cb(false) end -- Cancelled
            end
        end)
    end
end
```

### ⏳ 3. Custom Progress Bar - Stop

If you set `Config.ProgressbarSystem = "custom"`, you can integrate your own progress bar.

```lua
function StopProgressBar()
    if Config.ProgressbarSystem == "auto" then
        Core.StopProgressBar()

    elseif Config.ProgressbarSystem == "ox" then
        lib.cancelProgress()
        
    elseif Config.ProgressbarSystem == "custom" then
        -- example:
        -- TriggerEvent('my_progress:cancel')
    end
end
```

### 🚨 4. Custom Police Dispatch / Alerts

If you set `Config.PoliceAlertSystem = "custom"`, you can hook your dispatch system (like ps-dispatch, cd\_dispatch, project-error, etc.) to notify officers when a vehicle is being lockpicked or stolen.

```lua
function SendPoliceAlert(alertType)
    if Config.PoliceAlertSystem == "qb" then
        TriggerServerEvent('police:server:policeAlert', Lang:t('info.palert') .. alertType)
    elseif Config.PoliceAlertSystem == "custom" then
        -- EXAMPLE INTEGRATION (e.g., using custom dispatch trigger):
        local coords = GetEntityCoords(PlayerPedId())
        TriggerServerEvent('your_dispatch:server:sendAlert', {
            code = '10-90',
            street = GetStreetNameAtCoord(coords.x, coords.y, coords.z),
            coords = coords,
            message = 'Vehicle Lockpicking In Progress: ' .. alertType
        })
    end
end
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://crystal-studios.gitbook.io/crystal-studios-docs/vehicle-keys/configuration/cl_utils.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
