# Frequent Questions

## ¿Why the alert is not being triggered with my robbery script?

If the alert is not running when a theft is executed, it is very possible that it is because you do not have the export/event added within that script, [here](https://docs.origennetwork.store/origen-police/exports) is the list of exports to be able to add alerts.

## ¿Why I can't see buttons to add data in the criminal code?

{% tabs %}
{% tab title="QBCore" %}
In qbcore you can define which ranks are bosses, if you do not have a rank that is considered a boss you will not be able to see the criminal code buttons.

Here we show an example where rank 4 is considered a boss and therefore will be able to see the buttons to add criminal code.

{% code title="qb-core/shared/jobs.lua" %}

```lua
police = {
	label = 'Law Enforcement',
	type = 'leo',
	defaultDuty = true,
	offDutyPay = false,
	grades = {
		['0'] = { name = 'Recruit', payment = 50 },
		['1'] = { name = 'Officer', payment = 75 },
		['2'] = { name = 'Sergeant', payment = 100 },
		['3'] = { name = 'Lieutenant', payment = 125 },
		['4'] = { name = 'Chief', isboss = true, payment = 150 }, -- BOSS
	},
},
```

{% endcode %}
{% endtab %}

{% tab title="ESX" %}
You will have to set in `config/permissions.lua` what ranks will be considered as boss, by default the boss will be rank 4, you can add as many as you want.

Example with some ranks as boss(4, 5, 6):

```lua
Config.BossGrade = { 4, 5, 6 }  -- ONLY ESX, set the grades that will be considered as boss and will have more permissions like manage penal code
```

{% endtab %}
{% endtabs %}

## ¿How to change department/jurisdiction of a job?

{% tabs %}
{% tab title="QBCore" %}
By default all ranges will have `LSPD` as department, you can change it by adding a field type in each range.

Example making rank 0, 1, 2, 3 be from department `LSSD` and rank 4 be from department `BCSO`

<pre class="language-lua"><code class="lang-lua">police = {
<strong>	label = 'Law Enforcement',
</strong>	type = 'leo',
	defaultDuty = true,
	offDutyPay = false,
	grades = {
		['0'] = { name = 'Recruit', payment = 50, type = "LSSD" },
		['1'] = { name = 'Officer', payment = 75, type = "LSSD" },
		['2'] = { name = 'Sergeant', payment = 100, type = "LSSD" },
		['3'] = { name = 'Lieutenant', payment = 125, type = "LSSD" },
		['4'] = { name = 'Chief', payment = 150, type = "BCSO", isboss = true, },
	},
},
</code></pre>

{% endtab %}

{% tab title="ESX" %}
By default all ranges will have `LSPD` as department, you can change it by editing the column type of each grade in the table `job_grades`.

Example with the police ranks 5, 6, 7, 8, 9 as LSPD and sheriff with LSSD.

<figure><img src="https://3936778620-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPLI7NdIesJTaEUHH6a2U%2Fuploads%2FyZdTpeZdhUpPUaMOsnB1%2Fimage.png?alt=media&#x26;token=4d337ec2-6866-40f4-895f-f7f5f78e0d31" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## SQL Error illegal mix of collations

This error occurs when a `JOIN` is performed between columns that use different collations. In our case, this happens when querying debtors by joining the `origen_police_bills` table with `players` or `users`.

To resolve this issue, make sure all text columns involved in the join use the same collation (e.g. `utf8mb4_general_ci` or `utf8mb4_unicode_ci`).

{% hint style="warning" %}
⚠️ **Important**: Make a backup before applying any collation changes—especially if your database contains Chinese, Japanese, or other non-UTF8MB4 characters.
{% endhint %}

{% tabs %}
{% tab title="QBCore" %}

```sql
ALTER TABLE origen_police_bills CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE players CONVERT TO CHARACTER SET utf8mb4;
```

{% endtab %}

{% tab title="ESX" %}

```sql
ALTER TABLE origen_police_bills CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE users CONVERT TO CHARACTER SET utf8mb4;
```

{% endtab %}
{% endtabs %}
